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 9f2f10ef5b [core] rest catalog: support default create table options 
(#6598)
9f2f10ef5b is described below

commit 9f2f10ef5b219fb33e431f1e7134a125d9068cf1
Author: jerry <[email protected]>
AuthorDate: Fri Nov 14 12:34:48 2025 +0800

    [core] rest catalog: support default create table options (#6598)
---
 .../src/main/java/org/apache/paimon/rest/RESTCatalog.java    |  3 +++
 .../java/org/apache/paimon/rest/MockRESTCatalogTest.java     | 12 ++++++++++++
 2 files changed, 15 insertions(+)

diff --git a/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java 
b/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java
index 12bce44149..f225acda88 100644
--- a/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java
+++ b/paimon-core/src/main/java/org/apache/paimon/rest/RESTCatalog.java
@@ -96,6 +96,7 @@ public class RESTCatalog implements Catalog {
     private final RESTApi api;
     private final CatalogContext context;
     private final boolean dataTokenEnabled;
+    protected final Map<String, String> tableDefaultOptions;
 
     public RESTCatalog(CatalogContext context) {
         this(context, true);
@@ -110,6 +111,7 @@ public class RESTCatalog implements Catalog {
                         context.preferIO(),
                         context.fallbackIO());
         this.dataTokenEnabled = 
api.options().get(RESTTokenFileIO.DATA_TOKEN_ENABLED);
+        this.tableDefaultOptions = 
CatalogUtils.tableDefaultOptions(context.options().toMap());
     }
 
     @Override
@@ -448,6 +450,7 @@ public class RESTCatalog implements Catalog {
             checkNotSystemTable(identifier, "createTable");
             validateCreateTable(schema, dataTokenEnabled);
             createExternalTablePathIfNotExist(schema);
+            tableDefaultOptions.forEach(schema.options()::putIfAbsent);
             Schema newSchema = inferSchemaIfExternalPaimonTable(schema);
             api.createTable(identifier, newSchema);
         } catch (AlreadyExistsException e) {
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 b27fbc1735..0fc0f83394 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
@@ -52,6 +52,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
+import static org.apache.paimon.catalog.Catalog.TABLE_DEFAULT_OPTION_PREFIX;
 import static org.apache.paimon.rest.RESTApi.HEADER_PREFIX;
 import static org.assertj.core.api.Assertions.assertThatExceptionOfType;
 import static org.assertj.core.api.Assertions.assertThatThrownBy;
@@ -175,6 +176,17 @@ class MockRESTCatalogTest extends RESTCatalogTest {
         assertEquals(headers2.get("User-Agent"), "test");
     }
 
+    @Test
+    void testCreateTableDefaultOptions() throws Exception {
+        options.set(TABLE_DEFAULT_OPTION_PREFIX + "default-key", 
"default-value");
+        RESTCatalog restCatalog = initCatalog(false);
+        Identifier identifier = Identifier.create("db1", 
"new_table_default_options");
+        restCatalog.createDatabase(identifier.getDatabaseName(), true);
+        restCatalog.createTable(identifier, DEFAULT_TABLE_SCHEMA, true);
+        assertEquals(
+                restCatalog.getTable(identifier).options().get("default-key"), 
"default-value");
+    }
+
     @Test
     void testBaseHeadersInRequests() throws Exception {
         // Set custom headers in options

Reply via email to