danny0405 commented on a change in pull request #11568:
URL: https://github.com/apache/flink/pull/11568#discussion_r411824095



##########
File path: flink-table/flink-sql-parser/src/main/codegen/data/Parser.tdd
##########
@@ -445,9 +445,10 @@
   # Return type of method implementation should be "SqlTypeNameSpec".
   # Example: SqlParseTimeStampZ().
   dataTypeParserMethods: [
-    "ExtendedSqlBasicTypeName()"
-    "CustomizedCollectionsTypeName()"
-    "SqlMapTypeName()"
+    "ExtendedSqlBasicTypeName()",
+    "CustomizedCollectionsTypeName()",
+    "SqlMapTypeName()",
+    "SqlRawTypeName()",
     "ExtendedSqlRowTypeName()"

Review comment:
       Remove the tailing comma ","

##########
File path: 
flink-table/flink-sql-parser/src/test/java/org/apache/flink/sql/parser/TestRelDataTypeFactory.java
##########
@@ -0,0 +1,64 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.flink.sql.parser;
+
+import org.apache.flink.table.calcite.ExtendedRelTypeFactory;
+
+import org.apache.calcite.rel.type.RelDataType;
+import org.apache.calcite.rel.type.RelDataTypeFactory;
+import org.apache.calcite.rel.type.RelDataTypeImpl;
+import org.apache.calcite.rel.type.RelDataTypeSystem;
+import org.apache.calcite.sql.type.SqlTypeFactoryImpl;
+
+/**
+ * {@link RelDataTypeFactory} for testing purposes.
+ */
+public final class TestRelDataTypeFactory extends SqlTypeFactoryImpl 
implements ExtendedRelTypeFactory {
+
+       TestRelDataTypeFactory(RelDataTypeSystem typeSystem) {
+               super(typeSystem);
+       }
+
+       @Override
+       public RelDataType createRawType(String className, String 
serializerString) {
+               return new DummyRawType(className, serializerString);
+       }

Review comment:
       The type should be canonized. So that we can compare it with object 
references.

##########
File path: 
flink-table/flink-table-planner-blink/src/main/scala/org/apache/flink/table/planner/calcite/FlinkTypeFactory.scala
##########
@@ -487,6 +496,9 @@ object FlinkTypeFactory {
       // CURSOR for UDTF case, whose type info will never be used, just a 
placeholder
       case CURSOR => new TypeInformationRawType[Nothing](new NothingTypeInfo)
 
+      case OTHER =>
+        relDataType.asInstanceOf[RawRelDataType].getRawType
+

Review comment:
       Better add an `instanceOf` protection here.

##########
File path: 
flink-table/flink-table-planner-blink/src/test/scala/org/apache/flink/table/planner/plan/stream/table/validation/TableSinkValidationTest.scala
##########
@@ -91,8 +91,8 @@ class TableSinkValidationTest extends TableTestBase {
     expectedException.expectMessage(
       "Field types of query result and registered TableSink default_catalog." +
       "default_database.testSink do not match.\n" +
-      "Query schema: [a: INT, b: BIGINT, c: STRING, d: BIGINT]\n" +
-      "Sink schema: [a: INT, b: BIGINT, c: STRING, d: INT]")
+      "Query schema: [a: INT, b: BIGINT, c: VARCHAR(2147483647), d: BIGINT]\n" 
+
+      "Sink schema: [a: INT, b: BIGINT, c: VARCHAR(2147483647), d: INT]")

Review comment:
       +1, why this change ~




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

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


Reply via email to