Skip to content

Commit

Permalink
[AMORO-2295]: Fix the table property watermark.base conflict for ke…
Browse files Browse the repository at this point in the history
…yed-table (apache#2317)

* fix table properties conflict for keyed-table
  • Loading branch information
baiyangtx authored Nov 17, 2023
1 parent 84dd431 commit 22167df
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions core/src/main/java/com/netease/arctic/table/BasicKeyedTable.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import org.apache.iceberg.UpdateSchema;
import org.apache.iceberg.events.CreateSnapshotEvent;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
import org.apache.iceberg.relocated.com.google.common.collect.Maps;

import java.util.Map;

Expand Down Expand Up @@ -119,22 +120,22 @@ public Map<String, String> properties() {
long changeWatermark = TablePropertyUtil.getTableWatermark(changeTable.properties());
long baseWatermark = TablePropertyUtil.getTableWatermark(baseTable.properties());

ImmutableMap.Builder<String, String> builder = ImmutableMap.builder();
Map<String, String> properties = Maps.newHashMap();
if (changeWatermark > baseWatermark) {
baseTable
.properties()
.forEach(
(k, v) -> {
if (!TableProperties.WATERMARK_TABLE.equals(k)) {
builder.put(k, v);
properties.put(k, v);
}
});
builder.put(TableProperties.WATERMARK_TABLE, String.valueOf(changeWatermark));
properties.put(TableProperties.WATERMARK_TABLE, String.valueOf(changeWatermark));
} else {
builder.putAll(baseTable.properties());
properties.putAll(baseTable.properties());
}
builder.put(TableProperties.WATERMARK_BASE_STORE, String.valueOf(baseWatermark));
return builder.build();
properties.put(TableProperties.WATERMARK_BASE_STORE, String.valueOf(baseWatermark));
return ImmutableMap.copyOf(properties);
}

@Override
Expand Down

0 comments on commit 22167df

Please sign in to comment.