This is an automated email from the ASF dual-hosted git repository. zouxxyy pushed a commit to branch dev/create-format-table in repository https://gitbox.apache.org/repos/asf/paimon.git
commit 6fc891f3459d42f2bb8753c65f98788e7d57e999 Author: zouxxyy <[email protected]> AuthorDate: Wed Nov 12 14:25:57 2025 +0800 [rest] Fix the checker of create format table with engine impl and path --- .../src/main/java/org/apache/paimon/catalog/CatalogUtils.java | 7 +++---- .../src/test/java/org/apache/paimon/rest/MockRESTCatalogTest.java | 7 ++++++- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java b/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java index f4d725814f..3517c18f3c 100644 --- a/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java +++ b/paimon-core/src/main/java/org/apache/paimon/catalog/CatalogUtils.java @@ -157,11 +157,10 @@ public class CatalogUtils { options.get(PRIMARY_KEY) == null, "Cannot define %s for format table.", PRIMARY_KEY.key()); - if (dataTokenEnabled) { + if (dataTokenEnabled && options.get(PATH) == null) { checkArgument( - options.get(PATH) == null - && options.get(FORMAT_TABLE_IMPLEMENTATION) - != CoreOptions.FormatTableImplementation.ENGINE, + options.get(FORMAT_TABLE_IMPLEMENTATION) + != CoreOptions.FormatTableImplementation.ENGINE, "Cannot define %s is engine for format table when data token is enabled and not define %s.", FORMAT_TABLE_IMPLEMENTATION.key(), PATH.key()); diff --git a/paimon-core/src/test/java/org/apache/paimon/rest/MockRESTCatalogTest.java b/paimon-core/src/test/java/org/apache/paimon/rest/MockRESTCatalogTest.java index e132c38e5a..b27fbc1735 100644 --- a/paimon-core/src/test/java/org/apache/paimon/rest/MockRESTCatalogTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/rest/MockRESTCatalogTest.java @@ -204,7 +204,7 @@ class MockRESTCatalogTest extends RESTCatalogTest { void testCreateFormatTableWhenEnableDataToken() throws Exception { RESTCatalog restCatalog = initCatalog(true); restCatalog.createDatabase("test_db", false); - // Create table creates a new table when it does not exist + // Create format table with engine impl without path is not allowed Identifier identifier = Identifier.create("test_db", "new_table"); Schema schema = Schema.newBuilder().column("c1", DataTypes.INT()).build(); schema.options().put(CoreOptions.TYPE.key(), TableType.FORMAT_TABLE.toString()); @@ -214,6 +214,11 @@ class MockRESTCatalogTest extends RESTCatalogTest { .isThrownBy(() -> restCatalog.createTable(identifier, schema, false)) .withMessage( "Cannot define format-table.implementation is engine for format table when data token is enabled and not define path."); + + // Create format table with engine impl and path + schema.options().put(CoreOptions.PATH.key(), dataPath + UUID.randomUUID()); + restCatalog.createTable(identifier, schema, false); + catalog.dropTable(identifier, true); }
