Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion paimon-python/pypaimon/common/identifier.py
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,9 @@ def __hash__(self):
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
16 changes: 16 additions & 0 deletions paimon-python/pypaimon/tests/identifier_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,22 @@ def test_invalid_backtick_format_raises_error(self):
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()
Loading