From 22167df7996735927193076cf2362fb4b37f5e05 Mon Sep 17 00:00:00 2001 From: baiyangtx Date: Fri, 17 Nov 2023 16:28:18 +0800 Subject: [PATCH] [AMORO-2295]: Fix the table property `watermark.base` conflict for keyed-table (#2317) * fix table properties conflict for keyed-table --- .../com/netease/arctic/table/BasicKeyedTable.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/src/main/java/com/netease/arctic/table/BasicKeyedTable.java b/core/src/main/java/com/netease/arctic/table/BasicKeyedTable.java index 3f363c4e27..fa039cf05f 100644 --- a/core/src/main/java/com/netease/arctic/table/BasicKeyedTable.java +++ b/core/src/main/java/com/netease/arctic/table/BasicKeyedTable.java @@ -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; @@ -119,22 +120,22 @@ public Map properties() { long changeWatermark = TablePropertyUtil.getTableWatermark(changeTable.properties()); long baseWatermark = TablePropertyUtil.getTableWatermark(baseTable.properties()); - ImmutableMap.Builder builder = ImmutableMap.builder(); + Map 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