Skip to content

Conversation

@findepi
Copy link
Member

@findepi findepi commented Oct 22, 2025

Provide safe default implementation of
ConnectorMetadata.getTableHandle. This prevents exception when trying
to access a table from a connector that exposes no regular tables at
all, such as GlobalSystemConnector that powers the builtin system
catalog.

This change impacts regular queries for non-existent tables in existing
schemas of the system catalog, such as:

SELECT * FROM system.jdbc.columnxx

After the change, a correct "Table does not exist" error is returned.

This change also affects metadata listing operations, such as

select * from system.jdbc.columns
where table_schem = 'tiny' and table_name = 'nation';

or

select * from system.information_schema.columns
where table_schema = 'jdbc' and table_name = 'columnxx';

Metadata listing operations are highly optimized and call
getTableHandle directly if it is possible to avoid listing tables.
Before the change the query would succeed, but would result in a
ConnectorMetadata getTableHandle() is not implemented exception logged
at WARN level. After the change, no exception is logged.

Release notes

* Return correct "Table does not exist" error when querying a non-existent table in an existing schema within `system` catalog.
* Avoid logging an exception when listing columns from tables from a set of catalogs that includes the `system` catalog. (#27045)

Summary by Sourcery

Provide a safe default implementation of ConnectorMetadata.getTableHandle, fix error handling for non-existent tables in system catalogs, and add tests to verify the correct "Table does not exist" behavior.

Bug Fixes:

  • Return a proper "Table does not exist" error instead of throwing exceptions for queries against non-existent tables in system catalogs
  • Prevent warning-level exceptions when listing metadata for non-existent tables

Enhancements:

  • Add default ConnectorMetadata.getTableHandle method that returns null when a schema has no tables

Tests:

  • Add tests for querying non-existent tables in system.metadata and system.runtime connectors to verify error handling

@cla-bot cla-bot bot added the cla-signed label Oct 22, 2025
@sourcery-ai

This comment was marked as resolved.

Provide safe default implementation of
`ConnectorMetadata.getTableHandle`. This prevents exception when trying
to access a table from a connector that exposes no regular tables at
all, such as `GlobalSystemConnector` that powers the builtin `system`
catalog.

This change impacts regular queries for non-existent tables in existing
schemas of the system catalog, such as:

    SELECT * FROM system.jdbc.columnxx

After the change, a correct "Table does not exist" error is returned.

This change also affects metadata listing operations, such as

    select * from system.jdbc.columns
    where table_schem = 'tiny' and table_name = 'nation';

or

    select * from system.information_schema.columns
    where table_schema = 'jdbc' and table_name = 'columnxx';

Metadata listing operations are highly optimized and call
`getTableHandle` directly if it is possible to avoid listing tables.
Before the change the query would succeed, but would result in a
`ConnectorMetadata getTableHandle() is not implemented` exception logged
at WARN level. After the change, no exception is logged.
sourcery-ai[bot]

This comment was marked as resolved.

@findepi findepi force-pushed the findepi/provide-safe-default-implementation-of-gettablehandle-50dfd3 branch from 4a12e73 to a560b75 Compare October 22, 2025 11:49
@findepi findepi changed the title Findepi/provide safe default implementation of gettablehandle 50dfd3 Provide safe default implementation of getTableHandle Oct 22, 2025
@findepi findepi merged commit 8b5edc9 into trinodb:master Oct 24, 2025
199 of 201 checks passed
@findepi findepi deleted the findepi/provide-safe-default-implementation-of-gettablehandle-50dfd3 branch October 24, 2025 15:14
@github-actions github-actions bot added this to the 478 milestone Oct 24, 2025
@findepi findepi added no-release-notes This pull request does not require release notes entry and removed no-release-notes This pull request does not require release notes entry labels Oct 24, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Development

Successfully merging this pull request may close these issues.

ConnectorMetadata getTableHandle() is not implemented exception logged when handling legitimate user query

3 participants