From da339e1ed976c8dbb9f024c11fa0c0f4daecae56 Mon Sep 17 00:00:00 2001 From: Jinyang Li Date: Thu, 31 Jul 2025 14:12:56 -0700 Subject: [PATCH] Allow commit.retry.num-retries specified in extra_properties --- .../src/main/java/io/trino/plugin/iceberg/IcebergUtil.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergUtil.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergUtil.java index 12cc223b958b..0f7e2a091ea0 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergUtil.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergUtil.java @@ -871,11 +871,15 @@ public static Transaction newCreateTableTransaction(TrinoCatalog catalog, Connec public static Map createTableProperties(ConnectorSession session, ConnectorTableMetadata tableMetadata, Predicate allowedExtraProperties) { + Map extraProperties = IcebergTableProperties.getExtraProperties(tableMetadata.getProperties()).orElseGet(ImmutableMap::of); + ImmutableMap.Builder propertiesBuilder = ImmutableMap.builder(); IcebergFileFormat fileFormat = IcebergTableProperties.getFileFormat(tableMetadata.getProperties()); propertiesBuilder.put(DEFAULT_FILE_FORMAT, fileFormat.toIceberg().toString()); propertiesBuilder.put(FORMAT_VERSION, Integer.toString(IcebergTableProperties.getFormatVersion(tableMetadata.getProperties()))); - propertiesBuilder.put(COMMIT_NUM_RETRIES, Integer.toString(IcebergTableProperties.getMaxCommitRetry(tableMetadata.getProperties()))); + if (!extraProperties.containsKey(COMMIT_NUM_RETRIES)) { + propertiesBuilder.put(COMMIT_NUM_RETRIES, Integer.toString(IcebergTableProperties.getMaxCommitRetry(tableMetadata.getProperties()))); + } HiveCompressionCodec compressionCodec = toCompressionCodec(getCompressionCodec(session)); switch (fileFormat) { @@ -920,7 +924,6 @@ public static Map createTableProperties(ConnectorSession session } Map baseProperties = propertiesBuilder.buildOrThrow(); - Map extraProperties = IcebergTableProperties.getExtraProperties(tableMetadata.getProperties()).orElseGet(ImmutableMap::of); verifyExtraProperties(baseProperties.keySet(), extraProperties, allowedExtraProperties);