From b246015998f199ff7e337e9d640313de2f692ffd Mon Sep 17 00:00:00 2001 From: ismail simsek <6005685+ismailsimsek@users.noreply.github.com> Date: Sun, 8 Sep 2024 11:03:50 +0200 Subject: [PATCH] Explicitly set operationId when creating OutputFileFactory (#414) --- .../debezium/server/iceberg/IcebergUtil.java | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/debezium-server-iceberg-sink/src/main/java/io/debezium/server/iceberg/IcebergUtil.java b/debezium-server-iceberg-sink/src/main/java/io/debezium/server/iceberg/IcebergUtil.java index a766060b..38eaadbf 100644 --- a/debezium-server-iceberg-sink/src/main/java/io/debezium/server/iceberg/IcebergUtil.java +++ b/debezium-server-iceberg-sink/src/main/java/io/debezium/server/iceberg/IcebergUtil.java @@ -23,9 +23,6 @@ import org.apache.iceberg.data.GenericAppenderFactory; import org.apache.iceberg.exceptions.NoSuchTableException; import org.apache.iceberg.io.OutputFileFactory; -import org.apache.iceberg.relocated.com.google.common.collect.Maps; -import org.apache.iceberg.relocated.com.google.common.collect.Sets; -import org.apache.iceberg.types.TypeUtil; import org.eclipse.microprofile.config.Config; import org.eclipse.microprofile.config.ConfigProvider; import org.eclipse.microprofile.config.ConfigValue; @@ -35,9 +32,17 @@ import java.time.Instant; import java.time.ZoneOffset; import java.time.format.DateTimeFormatter; -import java.util.*; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; +import java.util.Optional; +import java.util.Set; +import java.util.UUID; + +import static org.apache.iceberg.TableProperties.DEFAULT_FILE_FORMAT; +import static org.apache.iceberg.TableProperties.DEFAULT_FILE_FORMAT_DEFAULT; +import static org.apache.iceberg.TableProperties.FORMAT_VERSION; -import static org.apache.iceberg.TableProperties.*; /** * @author Ismail Simsek @@ -176,7 +181,10 @@ public static GenericAppenderFactory getTableAppender(Table icebergTable) { public static OutputFileFactory getTableOutputFileFactory(Table icebergTable, FileFormat format) { return OutputFileFactory.builderFor(icebergTable, IcebergUtil.partitionId(), 1L) - .defaultSpec(icebergTable.spec()).format(format).build(); + .defaultSpec(icebergTable.spec()) + .operationId(UUID.randomUUID().toString()) + .format(format) + .build(); } public static int partitionId() {