godfreyhe commented on a change in pull request #18967:
URL: https://github.com/apache/flink/pull/18967#discussion_r836015135



##########
File path: 
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/calcite/PreValidateReWriter.scala
##########
@@ -391,8 +392,19 @@ object PreValidateReWriter {
       == desiredType)) {
       node
     } else {
-      SqlStdOperatorTable.CAST.createCall(SqlParserPos.ZERO,
-        node, SqlTypeUtil.convertTypeToSpec(desiredType))
+      // See FLINK-26460 for more details
+      val sqlDataTypeSpec =
+        if (currentType.getSqlTypeName == SqlTypeName.NULL
+          && desiredType.getSqlTypeName == SqlTypeName.MAP) {

Review comment:
       SqlTypeUtil.isNull(currentType) && SqlTypeUtil.isMap(desiredType)

##########
File path: 
flink-table/flink-table-planner/src/main/scala/org/apache/flink/table/planner/calcite/PreValidateReWriter.scala
##########
@@ -391,8 +392,19 @@ object PreValidateReWriter {
       == desiredType)) {
       node
     } else {
-      SqlStdOperatorTable.CAST.createCall(SqlParserPos.ZERO,
-        node, SqlTypeUtil.convertTypeToSpec(desiredType))
+      // See FLINK-26460 for more details
+      val sqlDataTypeSpec =
+        if (currentType.getSqlTypeName == SqlTypeName.NULL
+          && desiredType.getSqlTypeName == SqlTypeName.MAP) {
+          new SqlDataTypeSpec(
+            new 
SqlMapTypeNameSpec(SqlTypeUtil.convertTypeToSpec(desiredType.getKeyType),

Review comment:
       we should consider whether the key type and value type are not null, 
such as: MAP<STRING NOT NULL, BIGINT>, MAP<STRING NOT NULL, BIGINT NOT NULL>




-- 
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