raminqaf commented on code in PR #30029:
URL: https://github.com/apache/flink/pull/30029#discussion_r4631599841
##########
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:
Do we need this check here? I think the `addDeclaredColumn` already does
this check.
##########
flink-table/flink-table-api-java/src/main/java/org/apache/flink/table/operations/utils/AsQuerySchemaMerger.java:
##########
Review Comment:
Since you are add it: Do we have a test for this path? I think all your
tests hit the `if` 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]