Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FLINK-37012][transform] Fix exception caused by metadataColumns causing argument type mismatch #3837

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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 @@ -186,9 +186,7 @@ private TransformExpressionKey generateTransformExpressionKey() {
break;
}
}
}

for (String originalColumnName : originalColumnNames) {
METADATA_COLUMNS.stream()
.filter(col -> col.f0.equals(originalColumnName))
.findFirst()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,10 @@ public class PostTransformOperatorTest {
.physicalColumn("name", DataTypes.STRING())
.physicalColumn("name_upper", DataTypes.STRING())
.physicalColumn("tbname", DataTypes.STRING().notNull())
.physicalColumn("tbname_sid", DataTypes.STRING())
.physicalColumn("sid_tbname", DataTypes.STRING())
.physicalColumn("tbname_name", DataTypes.STRING())
.physicalColumn("name_tbname", DataTypes.STRING())
.primaryKey("sid")
.build();

Expand Down Expand Up @@ -543,7 +547,9 @@ void testMetadataASTransform() throws Exception {
PostTransformOperator.newBuilder()
.addTransform(
METADATA_AS_TABLEID.identifier(),
"sid, name, UPPER(name) as name_upper, __table_name__ as tbname",
"sid, name, UPPER(name) as name_upper, __table_name__ as tbname, "
+ "concat(__table_name__,'_',sid) as tbname_sid, concat(sid,'_',__table_name__) as sid_tbname,"
+ "concat(__table_name__,'_',name) as tbname_name, concat(name,'_',__table_name__) as name_tbname",
"sid < 3")
.build();
RegularEventOperatorTestHarness<PostTransformOperator, Event>
Expand All @@ -561,7 +567,16 @@ void testMetadataASTransform() throws Exception {
DataChangeEvent.insertEvent(
METADATA_AS_TABLEID,
recordDataGenerator.generate(
new Object[] {1, new BinaryStringData("abc"), null, null}));
new Object[] {
1,
new BinaryStringData("abc"),
null,
null,
null,
null,
null,
null
}));
DataChangeEvent insertEventExpect =
DataChangeEvent.insertEvent(
METADATA_AS_TABLEID,
Expand All @@ -570,7 +585,11 @@ void testMetadataASTransform() throws Exception {
1,
new BinaryStringData("abc"),
new BinaryStringData("ABC"),
new BinaryStringData("metadata_as_table")
new BinaryStringData("metadata_as_table"),
new BinaryStringData("metadata_as_table_1"),
new BinaryStringData("1_metadata_as_table"),
new BinaryStringData("metadata_as_table_abc"),
new BinaryStringData("abc_metadata_as_table")
}));
transform.processElement(new StreamRecord<>(createTableEvent));
Assertions.assertThat(
Expand Down
Loading