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

Update StarRocksSinkOptions.java #348

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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 @@ -514,7 +514,15 @@ public StreamLoadProperties getProperties(@Nullable StarRocksSinkTable table) {
.enableUpsertDelete(supportUpsertDelete());

if (hasColumnMappingProperty()) {
defaultTablePropertiesBuilder.columns(streamLoadProps.get("columns"));
List<String> columns = new ArrayList<>(Arrays.asList(streamLoadProps.get("columns").split(",")));
if (supportUpsertDelete()) {
// auto add `__op` for primary key table even when user specified `sink.properties.columns`.
// in case user use a bitmap datatype and need set up `sink.properties.columns`, may forget to add `__op`.
if (columns.stream().noneMatch(it -> it.equals("__op"))) {
columns.add("__op");
}
}
defaultTablePropertiesBuilder.columns(String.join(",", columns));
} else if (getTableSchemaFieldNames() != null) {
// don't need to add "columns" header in following cases
// 1. use csv format but the flink and starrocks schemas are aligned
Expand Down