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 ee28b547c0 [python] Fix Identifier.is_system_table() (#7651)
ee28b547c0 is described below

commit ee28b547c0b7c8c0a7ed0530cb08e13aa9ed5c8b
Author: Jiajia Li <[email protected]>
AuthorDate: Thu Apr 16 16:12:22 2026 +0800

    [python] Fix Identifier.is_system_table() (#7651)
---
 paimon-python/pypaimon/common/identifier.py     |  7 ++++++-
 paimon-python/pypaimon/tests/identifier_test.py | 16 ++++++++++++++++
 2 files changed, 22 insertions(+), 1 deletion(-)

diff --git a/paimon-python/pypaimon/common/identifier.py 
b/paimon-python/pypaimon/common/identifier.py
index 45615233d1..a8ce6fbea0 100755
--- a/paimon-python/pypaimon/common/identifier.py
+++ b/paimon-python/pypaimon/common/identifier.py
@@ -107,4 +107,9 @@ class Identifier:
         return hash((self.database, self.object, self.branch))
 
     def is_system_table(self) -> bool:
-        return self.object.startswith('$')
+        if SYSTEM_TABLE_SPLITTER not in self.object:
+            return False
+        parts = self.object.split(SYSTEM_TABLE_SPLITTER)
+        if len(parts) == 2:
+            return not parts[1].startswith(SYSTEM_BRANCH_PREFIX)
+        return len(parts) == 3
diff --git a/paimon-python/pypaimon/tests/identifier_test.py 
b/paimon-python/pypaimon/tests/identifier_test.py
index 7bb6bb548a..806f16d599 100644
--- a/paimon-python/pypaimon/tests/identifier_test.py
+++ b/paimon-python/pypaimon/tests/identifier_test.py
@@ -92,6 +92,22 @@ class IdentifierTest(unittest.TestCase):
         with self.assertRaises(ValueError):
             Identifier.from_string("`a`.`b`.`c`")
 
+    def test_is_system_table_regular_table(self):
+        """A plain table object is not a system table."""
+        self.assertFalse(Identifier.create("mydb", 
"mytable").is_system_table())
+
+    def test_is_system_table_snapshots_suffix(self):
+        """object name '<base>$snapshots' is a system table."""
+        self.assertTrue(Identifier.create("mydb", 
"orders$snapshots").is_system_table())
+
+    def test_is_system_table_schemas_suffix(self):
+        """object name '<base>$schemas' is a system table."""
+        self.assertTrue(Identifier.create("mydb", 
"orders$schemas").is_system_table())
+
+    def test_is_system_table_files_suffix(self):
+        """object name '<base>$files' is a system table."""
+        self.assertTrue(Identifier.create("mydb", 
"orders$files").is_system_table())
+
 
 if __name__ == '__main__':
     unittest.main()

Reply via email to