Skip to content

[python] Load system tables and reject branches in JDBC get_table - #10896

Open
plusplusjiajia wants to merge 1 commit into
apache:masterfrom
plusplusjiajia:fix/python-jdbc-system-and-branch-tables
Open

plusplusjiajia wants to merge 1 commit into
apache:masterfrom
plusplusjiajia:fix/python-jdbc-system-and-branch-tables

Conversation

@plusplusjiajia

Copy link
Copy Markdown
Member

Purpose

JdbcCatalog.get_table ignored the $ suffix of the identifier. For example, db.t$snapshots, db.t$options and db.t$nosuch all returned the data table, and db.t$branch_dev returned a table with main's schema even when that branch did not exist.

As in Java AbstractCatalog.getTable, system tables are now loaded through the shared system table loader, as in the filesystem catalog, and unknown system table names raise TableNotExistException. As in Java JdbcCatalog.loadTableSchema (assertMainBranch), a branch other than main raises NotImplementedError, Python's counterpart of UnsupportedOperationException. As in alter_table, only a branch in the name counts, so Identifier('db', 't', branch='MAIN') still reads db.t.

Tests

  • JdbcCatalogTest#test_get_system_table: $options, $OPTIONS and $branch_main$options load the options system table of the data table, by name and by Identifier.
  • JdbcCatalogTest#test_get_system_table_not_exist: unknown system tables and system tables of missing tables raise TableNotExistException.
  • JdbcCatalogTest#test_get_table_branch: main branch identifiers read the table, and other branches, also with a system table suffix, raise NotImplementedError.
  • catalog_table_guard_test.py: the shared guard test no longer expects JDBC to read $branch_dev.
  • The 3 new tests fail on master. The related tests pass locally: 14 tests in jdbc_catalog_test.py and catalog_table_guard_test.py. flake8 is clean.

JdbcCatalog.get_table ignored the $ suffix of the identifier: for example
db.t$snapshots, db.t$options and db.t$nosuch all returned the data table,
and db.t$branch_dev returned a table with main's schema even when that
branch did not exist.

As in Java, system tables are now loaded through the shared system table
loader, as in the filesystem catalog, and unknown names raise
TableNotExistException. As in Java JdbcCatalog, a branch other than main
raises NotImplementedError; as in alter_table, only a branch in the name
counts, so Identifier('db', 't', branch='MAIN') still reads db.t.
@plusplusjiajia
plusplusjiajia marked this pull request as ready for review October 30, 2026 12:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant