From 8fa45bcecabfdcb118b10ddf514c76cc134ea919 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20P=C3=BCtz?= Date: Mon, 29 Sep 2025 15:41:06 +0200 Subject: [PATCH 1/2] fix(iceberg): fix table creation without namespace location fix table creation on non-s3tables REST catalogs that don't specify namespace location --- .../main/java/io/trino/plugin/iceberg/IcebergMetadata.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java index 5297ec1cb21c..0021b6ca78a7 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java @@ -1281,10 +1281,13 @@ public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, Con .orElseGet(() -> catalog.defaultTableLocation(session, tableMetadata.getTable())); } transaction = newCreateTableTransaction(catalog, tableMetadata, session, replace, tableLocation, allowedExtraProperties); + Location location = Location.of(transaction.table().location()); try { // S3 Tables internally assigns a unique location for each table - if (!isS3Tables(location.toString())) { + // we create a non-staged table if tableLocation.isEmpty(), in that case, the table location will not be + // empty + if (!isS3Tables(location.toString()) && !(tableLocation != null && tableLocation.isEmpty())) { TrinoFileSystem fileSystem = fileSystemFactory.create(session.getIdentity(), transaction.table().io().properties()); if (!replace && fileSystem.listFiles(location).hasNext()) { throw new TrinoException(ICEBERG_FILESYSTEM_ERROR, format("" + From 11978708a983f57d5cc109abd5f27f4b7edcf7e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tobias=20P=C3=BCtz?= Date: Mon, 29 Sep 2025 15:53:23 +0200 Subject: [PATCH 2/2] undo accidental newline --- .../src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java | 1 - 1 file changed, 1 deletion(-) diff --git a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java index 0021b6ca78a7..702714b253b7 100644 --- a/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java +++ b/plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java @@ -1281,7 +1281,6 @@ public ConnectorOutputTableHandle beginCreateTable(ConnectorSession session, Con .orElseGet(() -> catalog.defaultTableLocation(session, tableMetadata.getTable())); } transaction = newCreateTableTransaction(catalog, tableMetadata, session, replace, tableLocation, allowedExtraProperties); - Location location = Location.of(transaction.table().location()); try { // S3 Tables internally assigns a unique location for each table