liuyongvs commented on code in PR #3238:
URL: https://github.com/apache/calcite/pull/3238#discussion_r1215551391


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlLibraryOperators.java:
##########
@@ -944,6 +944,31 @@ private static RelDataType 
arrayReturnType(SqlOperatorBinding opBinding) {
           ReturnTypes.TO_MAP_VALUES_NULLABLE,
           OperandTypes.MAP);
 
+  private static RelDataType mapReturnType(SqlOperatorBinding opBinding) {
+    final RelDataType keysArrayType = opBinding.collectOperandTypes().get(0);
+    final RelDataType valuesArrayType = opBinding.collectOperandTypes().get(1);
+    final boolean nullable = keysArrayType.isNullable() || 
valuesArrayType.isNullable();
+    return SqlTypeUtil.createMapType(
+        opBinding.getTypeFactory(),
+        requireNonNull(keysArrayType.getComponentType(), "inferred key type"),
+        requireNonNull(valuesArrayType.getComponentType(), "inferred value 
type"),
+        nullable);
+  }

Review Comment:
   comments:
           final boolean nullable = keysArrayType.isNullable() || 
valuesArrayType.isNullable();
    this should be ,so i add the unit test
       f.checkType("str_to_map(cast(null as varchar))",
           "(VARCHAR, VARCHAR) MAP");



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to