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/03/28 02:40:02 UTC

[GitHub] [flink] godfreyhe commented on a change in pull request #18967: [FLINK-26460][table-planner]Fix Unsupported type when convertTypeToSpec: MAP

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

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