AHeise commented on code in PR #26741:
URL: https://github.com/apache/flink/pull/26741#discussion_r2180353271
##########
flink-table/flink-table-common/src/main/java/org/apache/flink/table/api/Schema.java:
##########
@@ -680,24 +680,29 @@ public Schema build() {
//
----------------------------------------------------------------------------------------
private void addResolvedColumns(List<Column> columns) {
- columns.forEach(
- c -> {
- if (c instanceof PhysicalColumn) {
- final PhysicalColumn physicalColumn =
(PhysicalColumn) c;
+ for (Column c : columns) {
+ if (c instanceof PhysicalColumn) {
+ PhysicalColumn physicalColumn = (PhysicalColumn) c;
+ final Builder builder =
column(physicalColumn.getName(),
physicalColumn.getDataType());
- } else if (c instanceof ComputedColumn) {
- final ComputedColumn computedColumn =
(ComputedColumn) c;
+ c.getComment().ifPresent(builder::withComment);
+ } else if (c instanceof ComputedColumn) {
+ ComputedColumn computedColumn = (ComputedColumn) c;
+ final Builder builder =
columnByExpression(
computedColumn.getName(),
computedColumn.getExpression());
- } else if (c instanceof MetadataColumn) {
- final MetadataColumn metadataColumn =
(MetadataColumn) c;
+ c.getComment().ifPresent(builder::withComment);
+ } else if (c instanceof MetadataColumn) {
+ MetadataColumn metadataColumn = (MetadataColumn) c;
+ final Builder builder =
columnByMetadata(
metadataColumn.getName(),
metadataColumn.getDataType(),
metadataColumn.getMetadataKey().orElse(null),
metadataColumn.isVirtual());
- }
- });
+ c.getComment().ifPresent(builder::withComment);
Review Comment:
Unfortunately, the cases may not be exhaustive which would lead to
overwriting the column of the previously created column.
I lack the context on why the cases are not exhaustive though...
--
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]