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

[pipeline-common] use column name to judge whether a column is existed in a specific schema. #2801

Merged
merged 1 commit into from
Dec 3, 2023
Merged
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 @@ -89,7 +89,11 @@ private static Schema applyAddColumnEvent(AddColumnEvent event, Schema oldSchema
Preconditions.checkNotNull(
columnWithPosition.getExistingColumn(),
"existingColumn could not be null in BEFORE type AddColumnEvent");
int index = columns.indexOf(columnWithPosition.getExistingColumn());
List<String> columnNames =
columns.stream().map(Column::getName).collect(Collectors.toList());
int index =
columnNames.indexOf(
columnWithPosition.getExistingColumn().getName());
if (index < 0) {
throw new IllegalArgumentException(
columnWithPosition.getExistingColumn().getName()
Expand All @@ -103,7 +107,11 @@ private static Schema applyAddColumnEvent(AddColumnEvent event, Schema oldSchema
Preconditions.checkNotNull(
columnWithPosition.getExistingColumn(),
"existingColumn could not be null in AFTER type AddColumnEvent");
int index = columns.indexOf(columnWithPosition.getExistingColumn());
List<String> columnNames =
columns.stream().map(Column::getName).collect(Collectors.toList());
int index =
columnNames.indexOf(
columnWithPosition.getExistingColumn().getName());
if (index < 0) {
throw new IllegalArgumentException(
columnWithPosition.getExistingColumn().getName()
Expand Down