KurtYoung commented on a change in pull request #10096:
[FLINK-14623][table-api] Add computed column information into TableSc…
URL: https://github.com/apache/flink/pull/10096#discussion_r342956790
##########
File path:
flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/TableSchema.java
##########
@@ -386,9 +486,11 @@ public Builder field(String name, DataType dataType) {
public Builder fields(String[] names, DataType[] dataTypes) {
Preconditions.checkNotNull(names);
Preconditions.checkNotNull(dataTypes);
-
- fieldNames.addAll(Arrays.asList(names));
- fieldDataTypes.addAll(Arrays.asList(dataTypes));
+ validateFields(names, dataTypes);
Review comment:
We should move this validation logic inside `build()`. It's will be more
safer than current approach. For example, you can't really protect the field
names are all unique with current solution. I can add column `a` with
`field(String name, DataType dataType, String expression)`, and then add `a, b,
c` with this method.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services