Fix getSchemas returning JDBC-escaped catalog name in SEA mode#1365
Open
gopalldb wants to merge 1 commit intodatabricks:mainfrom
Open
Fix getSchemas returning JDBC-escaped catalog name in SEA mode#1365gopalldb wants to merge 1 commit intodatabricks:mainfrom
gopalldb wants to merge 1 commit intodatabricks:mainfrom
Conversation
e53de65 to
2dea12e
Compare
2dea12e to
bd8d83e
Compare
sreekanth-db
reviewed
Apr 1, 2026
| // Per JDBC spec, null foreign parameters means "don't filter on the foreign side." | ||
| // Since the SQL command can't express this, return an empty result set to match Thrift. | ||
| if (foreignCatalog == null || foreignSchema == null || foreignTable == null) { | ||
| LOGGER.debug( |
Collaborator
There was a problem hiding this comment.
Should we change the level to warn to let user know that that null filter is not supported ?
sreekanth-db
approved these changes
Apr 1, 2026
…in getCrossReference Two SEA/Thrift parity fixes: 1. getSchemas: Strip JDBC escapes and lowercase the catalog parameter before populating the TABLE_CATALOG result column. SHOW SCHEMAS IN `catalog` doesn't return a catalog column from the server, so the client populates it — but was using the raw JDBC-escaped value (e.g., "comparator\_tests" instead of "comparator_tests"). 2. getCrossReference: Return empty result set when all three foreign key parameters (catalog, schema, table) are null, instead of throwing DatabricksValidationException. Matches Thrift server behavior which delegates to getExportedKeys (returns empty in DBSQL). Note: Other null-catalog/null-schema parity gaps exist for getCrossReference, getImportedKeys, and getPrimaryKeys when individual parameters are null (Thrift resolves them to current catalog/schema via the server). These need a broader auto-fill fix and are tracked separately. Co-authored-by: Isaac Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
bd8d83e to
3aa4154
Compare
vikrantpuppala
approved these changes
Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes SEA/Thrift parity issue where
getSchemas()returnscomparator\_tests(with escaped underscore) instead ofcomparator_testsin theTABLE_CATALOGcolumn when using SEA mode (useThriftClient=0).Root Cause
In
DatabricksMetadataQueryClient.listSchemas(), thecatalogparameter from the JDBC caller can contain JDBC escape sequences (e.g.,comparator\_testswhere\_escapes the_wildcard). TheCommandBuildercorrectly strips these escapes for the SQL query (SHOW SCHEMAS IN \comparator_tests`), but the **original escaped value** was passed togetSchemasResult()`.Since
SHOW SCHEMAS IN \catalog`doesn't return acatalogcolumn from the server (onlySHOW SCHEMAS IN ALL CATALOGSdoes), the client falls back to populatingTABLE_CATALOG` from the passed parameter — inserting the JDBC-escaped value.Fix
Strip JDBC escapes from the
catalogparameter viaWildcardUtil.stripJdbcEscapes()before passing it togetSchemasResult().Verification
The
EscapedUnderscoreTestin../examplecan be used to verify end-to-end:Expected: Both Thrift and SEA should return
comparator_tests(without backslash) in TABLE_CATALOG for both escaped and unescaped input.Test plan
testListSchemasWithEscapedUnderscoreCatalog— verifies TABLE_CATALOG is unescapedEscapedUnderscoreTestagainst live environmentThis pull request was AI-assisted by Isaac.