Skip to content

Commit e05f797

Browse files
authored
[FLINK-37587][runtime] Fix error when adding a column using transform which has the same column name with one column of source table. (#3974)
1 parent 612ff5d commit e05f797

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

flink-cdc-runtime/src/test/java/org/apache/flink/cdc/runtime/parser/TransformParserTest.java

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,7 +443,8 @@ void testGenerateProjectionColumns() {
443443
Column.physicalColumn("address", DataTypes.VARCHAR(50), "newAddress"),
444444
Column.physicalColumn("deposit", DataTypes.DECIMAL(10, 2), "deposit"),
445445
Column.physicalColumn("weight", DataTypes.DOUBLE(), "weight"),
446-
Column.physicalColumn("height", DataTypes.DOUBLE(), "height"));
446+
Column.physicalColumn("height", DataTypes.DOUBLE(), "height"),
447+
Column.physicalColumn("op_type", DataTypes.TINYINT(), "op_type"));
447448

448449
List<ProjectionColumn> result =
449450
TransformParser.generateProjectionColumns(
@@ -465,7 +466,7 @@ void testGenerateProjectionColumns() {
465466

466467
List<ProjectionColumn> metadataResult =
467468
TransformParser.generateProjectionColumns(
468-
"*, __namespace_name__, __schema_name__, __table_name__",
469+
"*, __namespace_name__, __schema_name__, __table_name__, __data_event_type__ AS op_type",
469470
testColumns,
470471
Collections.emptyList(),
471472
new SupportedMetadataColumn[0]);
@@ -480,6 +481,7 @@ void testGenerateProjectionColumns() {
480481
"ProjectionColumn{column=`deposit` DECIMAL(10, 2) 'deposit', expression='deposit', scriptExpression='$0', originalColumnNames=[deposit], columnNameMap={deposit=$0}}",
481482
"ProjectionColumn{column=`weight` DOUBLE 'weight', expression='weight', scriptExpression='$0', originalColumnNames=[weight], columnNameMap={weight=$0}}",
482483
"ProjectionColumn{column=`height` DOUBLE 'height', expression='height', scriptExpression='$0', originalColumnNames=[height], columnNameMap={height=$0}}",
484+
"ProjectionColumn{column=`op_type` STRING NOT NULL, expression='__data_event_type__', scriptExpression='$0', originalColumnNames=[__data_event_type__], columnNameMap={__data_event_type__=$0}}",
483485
"ProjectionColumn{column=`__namespace_name__` STRING NOT NULL, expression='__namespace_name__', scriptExpression='$0', originalColumnNames=[__namespace_name__], columnNameMap={__namespace_name__=$0}}",
484486
"ProjectionColumn{column=`__schema_name__` STRING NOT NULL, expression='__schema_name__', scriptExpression='$0', originalColumnNames=[__schema_name__], columnNameMap={__schema_name__=$0}}",
485487
"ProjectionColumn{column=`__table_name__` STRING NOT NULL, expression='__table_name__', scriptExpression='$0', originalColumnNames=[__table_name__], columnNameMap={__table_name__=$0}}");

0 commit comments

Comments
 (0)