You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "wuchong (via GitHub)" <gi...@apache.org> on 2023/03/17 15:38:47 UTC

[GitHub] [flink] wuchong commented on a diff in pull request #22205: [FLINK-31494][table-planner] Introduce SqlNodeConverter for SqlToOperationConverter

wuchong commented on code in PR #22205:
URL: https://github.com/apache/flink/pull/22205#discussion_r1140393596


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/SqlNodeToOperationConversion.java:
##########
@@ -285,11 +287,18 @@ public static Optional<Operation> convert(
     private static Optional<Operation> convertValidatedSqlNode(
             FlinkPlannerImpl flinkPlanner, CatalogManager catalogManager, SqlNode validated) {
         beforeConversion();
-        SqlToOperationConverter converter =
-                new SqlToOperationConverter(flinkPlanner, catalogManager);
-        if (validated instanceof SqlCreateCatalog) {
-            return Optional.of(converter.convertCreateCatalog((SqlCreateCatalog) validated));
-        } else if (validated instanceof SqlDropCatalog) {
+
+        // delegate conversion to the registered converters first
+        SqlNodeConvertContext context = new SqlNodeConvertContext(flinkPlanner, catalogManager);
+        Optional<Operation> operation = SqlNodeConverters.convertSqlNode(validated, context);
+        if (operation.isPresent()) {
+            return operation;
+        }
+
+        // TODO: all the below conversion logic should be migrated to SqlNodeConverters

Review Comment:
   Yes, all the SqlNodes involved in the conversion should be migrated. 



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