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

JingsongLi 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 58b73e52b2 [python] Treat auto-create=false as false in create_table 
(#10191)
58b73e52b2 is described below

commit 58b73e52b243ecd00a9c382ef19c799dfb593f75
Author: jackylee <[email protected]>
AuthorDate: Sat Oct 3 17:10:41 2026 +0800

    [python] Treat auto-create=false as false in create_table (#10191)
---
 paimon-python/pypaimon/catalog/filesystem_catalog.py   |  4 +++-
 paimon-python/pypaimon/catalog/jdbc_catalog.py         |  4 +++-
 .../pypaimon/tests/filesystem_catalog_test.py          | 18 ++++++++++++++++++
 3 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/paimon-python/pypaimon/catalog/filesystem_catalog.py 
b/paimon-python/pypaimon/catalog/filesystem_catalog.py
index 52c42f163d..e71f9cc18a 100644
--- a/paimon-python/pypaimon/catalog/filesystem_catalog.py
+++ b/paimon-python/pypaimon/catalog/filesystem_catalog.py
@@ -35,6 +35,7 @@ from pypaimon.common.identifier import Identifier
 from pypaimon.common.options import Options
 from pypaimon.common.options.config import CatalogOptions
 from pypaimon.common.options.core_options import CoreOptions
+from pypaimon.common.options.options_utils import OptionsUtils
 from pypaimon.common.time_utils import (duration_to_iso8601,
                                         local_datetime_to_system_zone_millis)
 from pypaimon.filesystem.caching_file_io import CachingFileIO
@@ -179,7 +180,8 @@ class FileSystemCatalog(Catalog):
         return sys_table
 
     def create_table(self, identifier: Union[str, Identifier], schema: Schema, 
ignore_if_exists: bool) -> None:
-        if schema.options and 
schema.options.get(CoreOptions.AUTO_CREATE.key()):
+        auto_create = schema.options.get(CoreOptions.AUTO_CREATE.key()) if 
schema.options else None
+        if auto_create is not None and 
OptionsUtils.convert_to_boolean(auto_create):
             raise ValueError(f"The value of {CoreOptions.AUTO_CREATE.key()} 
property should be False.")
 
         if not isinstance(identifier, Identifier):
diff --git a/paimon-python/pypaimon/catalog/jdbc_catalog.py 
b/paimon-python/pypaimon/catalog/jdbc_catalog.py
index 6133b64751..da267fbdbf 100644
--- a/paimon-python/pypaimon/catalog/jdbc_catalog.py
+++ b/paimon-python/pypaimon/catalog/jdbc_catalog.py
@@ -411,7 +411,9 @@ class JdbcCatalog(Catalog):
         return FileStoreTable(self.file_io, identifier, table_path, 
table_schema, catalog_environment)
 
     def create_table(self, identifier: Union[str, Identifier], schema: Schema, 
ignore_if_exists: bool) -> None:
-        if schema.options and 
schema.options.get(CoreOptions.AUTO_CREATE.key()):
+        from pypaimon.common.options.options_utils import OptionsUtils
+        auto_create = schema.options.get(CoreOptions.AUTO_CREATE.key()) if 
schema.options else None
+        if auto_create is not None and 
OptionsUtils.convert_to_boolean(auto_create):
             raise ValueError(f"The value of {CoreOptions.AUTO_CREATE.key()} 
property should be False.")
         if not isinstance(identifier, Identifier):
             identifier = Identifier.from_string(identifier)
diff --git a/paimon-python/pypaimon/tests/filesystem_catalog_test.py 
b/paimon-python/pypaimon/tests/filesystem_catalog_test.py
index c22193ea15..2613b824a9 100644
--- a/paimon-python/pypaimon/tests/filesystem_catalog_test.py
+++ b/paimon-python/pypaimon/tests/filesystem_catalog_test.py
@@ -713,3 +713,21 @@ class FileSystemCatalogTest(unittest.TestCase):
 
         with self.assertRaises(ValueError):
             catalog.drop_partitions(identifier, [])
+
+    def test_create_table_auto_create_boolean_parsing(self):
+        fields = [DataField.from_dict({"id": 0, "name": "f0", "type": "INT"})]
+        catalog = CatalogFactory.create({"warehouse": self.warehouse})
+        catalog.create_database("test_db", False)
+
+        # auto-create=false is a legal no-op (the default) and must not be 
rejected.
+        catalog.create_table(
+            "test_db.ac_false",
+            Schema(fields=fields, options={"auto-create": "false"}), False)
+        self.assertTrue(
+            os.path.exists(self.warehouse + 
"/test_db.db/ac_false/schema/schema-0"))
+
+        # auto-create=true stays unsupported by create_table and is rejected.
+        with self.assertRaises(ValueError):
+            catalog.create_table(
+                "test_db.ac_true",
+                Schema(fields=fields, options={"auto-create": "true"}), False)

Reply via email to