Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.apache.seatunnel.api.table.catalog.CatalogTable;
import org.apache.seatunnel.api.table.catalog.Column;
import org.apache.seatunnel.api.table.catalog.ConstraintKey;
import org.apache.seatunnel.api.table.catalog.PhysicalColumn;
import org.apache.seatunnel.api.table.catalog.PrimaryKey;
import org.apache.seatunnel.api.table.catalog.TableIdentifier;
import org.apache.seatunnel.api.table.catalog.TablePath;
Expand Down Expand Up @@ -319,13 +320,48 @@ static CatalogTable mergeCatalogTable(CatalogTable tableOfPath, CatalogTable tab
tableOfPath.getTableId().getDatabaseName(),
tableOfPath.getTableId().getSchemaName(),
tableOfPath.getTableId().getTableName());
List<Column> columnsWithComment =

This comment was marked as off-topic.

tableSchemaOfQuery.getColumns().stream()
.map(
column -> {
return columnsOfPath.containsKey(column.getName())
&& columnsOfPath
.get(column.getName())
.getDataType()
.getSqlType()
.equals(
columnsOfQuery
.get(column.getName())
.getDataType()
Comment on lines +333 to +335
Copy link

Copilot AI Jul 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The comparison looks up columnsOfQuery.get(column.getName()), but column is already from that source. You can simplify by calling column.getDataType().getSqlType() directly to avoid the redundant map lookup.

Suggested change
columnsOfQuery
.get(column.getName())
.getDataType()
column.getDataType()

Copilot uses AI. Check for mistakes.
.getSqlType())
? PhysicalColumn.of(
column.getName(),
column.getDataType(),
column.getColumnLength() == null
? null
: Math.toIntExact(
column.getColumnLength()),
column.isNullable(),
column.getDefaultValue(),
columnsOfPath
.get(column.getName())
.getComment(),
column.getSourceType(),
column.isUnsigned(),
column.isZeroFill(),
column.getBitLen(),
column.getOptions(),
column.getLongColumnLength())
: column;
})
.collect(Collectors.toList());
CatalogTable mergedCatalogTable =
CatalogTable.of(
tableIdentifier,
TableSchema.builder()
.primaryKey(primaryKeyOfMerge)
.constraintKey(constraintKeysOfMerge)
.columns(tableSchemaOfQuery.getColumns())
.columns(columnsWithComment)
.build(),
tableOfPath.getOptions(),
partitionKeysOfMerge,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public class JdbcCatalogUtilsTest {
null,
false,
null,
null,
"f1 comment",
"int unsigned",
false,
false,
Expand All @@ -81,7 +81,7 @@ public class JdbcCatalogUtilsTest {
10,
false,
null,
null,
"f2 comment",
"varchar(10)",
false,
false,
Expand All @@ -95,7 +95,7 @@ public class JdbcCatalogUtilsTest {
20,
false,
null,
null,
"f3 comment",
"varchar(20)",
false,
false,
Expand Down Expand Up @@ -261,7 +261,7 @@ public void testColumnNotIncludeMerge() {
null,
true,
null,
null,
"f1 comment",
null,
false,
false,
Expand All @@ -275,7 +275,7 @@ public void testColumnNotIncludeMerge() {
10,
true,
null,
null,
"f2 comment",
null,
false,
false,
Expand All @@ -289,7 +289,7 @@ public void testColumnNotIncludeMerge() {
20,
false,
null,
null,
"f3 comment",
null,
false,
false,
Expand Down