snuyanzin commented on code in PR #27381:
URL: https://github.com/apache/flink/pull/27381#discussion_r2662308077
##########
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(
+ "%sAltering the nested row type `%s` is not
supported yet.",
+ exMsgPrefix, String.join("`.`",
identifier.names)));
Review Comment:
Ideally quoting requires dialect which could be derived with help of planner.
In order to not make it complicated continue without this since this is only
a message for Exception
--
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]