davidradl commented on code in PR #26741:
URL: https://github.com/apache/flink/pull/26741#discussion_r2180174790
##########
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:
This line is duplicated in all 3 conditions , are you happy to move it after
the if else's ? As these 3 subclasses are the only types of columns.
--
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]