Skip to content

Commit

Permalink
Update StarRocksSinkOptions.java
Browse files Browse the repository at this point in the history
auto add `__op` for primary key table even when user specified `sink.properties.columns`
  • Loading branch information
uicosp committed Mar 27, 2024
1 parent 08de67a commit 48fa663
Showing 1 changed file with 9 additions and 1 deletion.
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"));
String columns = streamLoadProps.get("columns");
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.endsWith(",__op")) {
columns = columns + ",__op";
}
}
defaultTablePropertiesBuilder.columns(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

0 comments on commit 48fa663

Please sign in to comment.