From 44755909e272c7bfa197a7f468ef821e8d40d7bc Mon Sep 17 00:00:00 2001 From: Karol Sobczak Date: Thu, 31 Oct 2024 16:29:20 +0100 Subject: [PATCH] Lowercase extra properties Iceberg and Trino properties are all lowercased --- .../java/io/trino/plugin/iceberg/IcebergTableProperties.java | 4 +++- .../io/trino/plugin/iceberg/BaseIcebergConnectorTest.java | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableProperties.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableProperties.java index 3497669e63e7..ca967be9652d 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableProperties.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergTableProperties.java @@ -31,6 +31,7 @@ import static com.google.common.base.Preconditions.checkState; import static com.google.common.collect.ImmutableList.toImmutableList; +import static com.google.common.collect.ImmutableMap.toImmutableMap; import static io.trino.plugin.iceberg.IcebergConfig.FORMAT_VERSION_SUPPORT_MAX; import static io.trino.plugin.iceberg.IcebergConfig.FORMAT_VERSION_SUPPORT_MIN; import static io.trino.spi.StandardErrorCode.INVALID_TABLE_PROPERTY; @@ -170,7 +171,8 @@ public IcebergTableProperties( throw new TrinoException(INVALID_TABLE_PROPERTY, format("Extra table property key cannot be null '%s'", extraProperties)); } - return extraProperties; + return extraProperties.entrySet().stream() + .collect(toImmutableMap(entry -> entry.getKey().toLowerCase(ENGLISH), Map.Entry::getValue)); }, value -> value)) .build(); diff --git a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/BaseIcebergConnectorTest.java b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/BaseIcebergConnectorTest.java index 4591a44781e7..ac80e61a9b7d 100644 --- a/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/BaseIcebergConnectorTest.java +++ b/plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/BaseIcebergConnectorTest.java @@ -8429,7 +8429,7 @@ public void testSystemTables() public void testExtraProperties() { String tableName = "test_create_table_with_multiple_extra_properties_" + randomNameSuffix(); - assertUpdate("CREATE TABLE " + tableName + " (c1 integer) WITH (extra_properties = MAP(ARRAY['extra.property.one', 'extra.property.two'], ARRAY['one', 'two']))"); + assertUpdate("CREATE TABLE " + tableName + " (c1 integer) WITH (extra_properties = MAP(ARRAY['extra.property.one', 'extra.property.TWO'], ARRAY['one', 'two']))"); assertThat(query("SELECT key, value FROM \"" + tableName + "$properties\" WHERE key IN ('extra.property.one', 'extra.property.two')")) .skippingTypesCheck()