Timm0 commented on code in PR #30029:
URL: https://github.com/apache/flink/pull/30029#discussion_r4632011456
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/api/internal/materializedtable/DescriptorMaterializedTableMergeContext.java:
##########
@@ -117,17 +117,9 @@ public Schema getMergedSchema() {
final AsQuerySchemaMerger merger =
new AsQuerySchemaMerger(querySchemaDeclaration.getColumns(),
dataTypeFactory);
final List<UnresolvedColumn> declaredColumns =
declaredSchema.getColumns();
- // Schema.Builder accepts repeated names, and the merger only rejects
a repeat of a column
- // the query doesn't produce.
- final Set<String> declaredNames = new HashSet<>();
for (int position = 0; position < declaredColumns.size(); position++) {
final UnresolvedColumn column = declaredColumns.get(position);
- if (!declaredNames.add(column.getName())) {
- throw new ValidationException(
- String.format(
- "A column named '%s' already exists in the
schema.",
- column.getName()));
- }
+ merger.checkNotDeclared(column.getName());
Review Comment:
This check was to keep the order of errors a user sees. So a duplicated
column error always shows up before a type error. Tbf this only matters if both
apply for a column so I removed the first check also for the SQL path.
--
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]