snuyanzin commented on code in PR #27381:
URL: https://github.com/apache/flink/pull/27381#discussion_r2660958901


##########
flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/utils/OperationConverterUtils.java:
##########
@@ -69,4 +86,153 @@ public static String getQuotedSqlString(SqlNode sqlNode, 
FlinkPlannerImpl flinkP
                                 
.withIdentifierQuoteString(parserConfig.quoting().string));
         return sqlNode.toSqlString(dialect).getSql();
     }
+
+    public static Set<String> getColumnNames(SqlNodeList sqlNodeList, String 
errMsgPrefix) {
+        Set<String> distinctNames = new HashSet<>();
+        for (SqlNode sqlNode : sqlNodeList) {
+            String name = extractSimpleColumnName((SqlIdentifier) sqlNode, 
errMsgPrefix);
+            if (!distinctNames.add(name)) {
+                throw new ValidationException(
+                        String.format("%sDuplicate column `%s`.", 
errMsgPrefix, name));
+            }
+        }
+        return distinctNames;
+    }
+
+    public static String extractSimpleColumnName(SqlIdentifier identifier, 
String exMsgPrefix) {
+        if (!identifier.isSimple()) {
+            throw new UnsupportedOperationException(
+                    String.format(
+                            "%sAlter nested row type %s is not supported yet.",

Review Comment:
   >nit: from what I can see the exMsgPrefix comes from the TableKind enum. So 
would read something like
   MATERIALIZED_TABLEAlter nested row ....
   
   This is not true, it comes from 
https://github.com/snuyanzin/flink/blob/44838279dd0575d02c308b86ce752a87db86a9ee/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/materializedtable/AbstractAlterMaterializedTableConverter.java#L41-L42
   
   or 
   
https://github.com/snuyanzin/flink/blob/44838279dd0575d02c308b86ce752a87db86a9ee/flink-table/flink-table-planner/src/main/java/org/apache/flink/table/planner/operations/converters/table/AbstractAlterTableConverter.java#L45
   
   TableKind enum is the second arg



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