You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/05/06 12:45:55 UTC

[GitHub] [flink] rovboyko commented on a diff in pull request #19648: [FLINK-27438][table-planner] Fix the constructing a map array

rovboyko commented on code in PR #19648:
URL: https://github.com/apache/flink/pull/19648#discussion_r866791321


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/utils/SqlValidatorUtils.java:
##########
@@ -76,9 +80,27 @@ private static void adjustTypeForMultisetConstructor(
     }
 
     private static SqlNode castTo(SqlNode node, RelDataType type) {
-        return SqlStdOperatorTable.CAST.createCall(
-                SqlParserPos.ZERO,
-                node,
-                SqlTypeUtil.convertTypeToSpec(type).withNullable(type.isNullable()));
+        SqlDataTypeSpec dataTypeSpec;

Review Comment:
   fixed



##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/functions/utils/SqlValidatorUtils.java:
##########
@@ -76,9 +80,27 @@ private static void adjustTypeForMultisetConstructor(
     }
 
     private static SqlNode castTo(SqlNode node, RelDataType type) {
-        return SqlStdOperatorTable.CAST.createCall(
-                SqlParserPos.ZERO,
-                node,
-                SqlTypeUtil.convertTypeToSpec(type).withNullable(type.isNullable()));
+        SqlDataTypeSpec dataTypeSpec;
+        if (SqlTypeUtil.isMap(type)) {
+            dataTypeSpec = getMapSqlDataTypeSpec(type);
+        } else {
+            dataTypeSpec = SqlTypeUtil.convertTypeToSpec(type).withNullable(type.isNullable());
+        }
+
+        return SqlStdOperatorTable.CAST.createCall(SqlParserPos.ZERO, node, dataTypeSpec);
+    }
+
+    private static SqlDataTypeSpec getMapSqlDataTypeSpec(RelDataType type) {
+        SqlDataTypeSpec dataTypeSpec;

Review Comment:
   fixed



-- 
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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org