This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new bc6654d034 [rest] Fix the checker of create format table with engine 
impl and path (#6588)
bc6654d034 is described below

commit bc6654d0347ad828258c4403187317dd31555fee
Author: Zouxxyy <[email protected]>
AuthorDate: Wed Nov 12 16:08:08 2025 +0800

    [rest] Fix the checker of create format table with engine impl and path 
(#6588)
---
 .../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);
     }
 

Reply via email to