Skip to content

Change UseQueryForMetadata default to 1 (SHOW commands)#1413

Merged
gopalldb merged 20 commits intodatabricks:mainfrom
gopalldb:feature/use-query-for-metadata-default
Apr 21, 2026
Merged

Change UseQueryForMetadata default to 1 (SHOW commands)#1413
gopalldb merged 20 commits intodatabricks:mainfrom
gopalldb:feature/use-query-for-metadata-default

Conversation

@gopalldb
Copy link
Copy Markdown
Collaborator

@gopalldb gopalldb commented Apr 21, 2026

Summary

Change the default value of UseQueryForMetadata from 0 to 1, making SQL SHOW commands the default for Thrift-mode metadata operations instead of native Thrift RPCs. This aligns Thrift metadata behavior with SEA mode for seamless server-side protocol switching.

Breaking Change

This is a breaking change for users who depend on Thrift-native metadata behavior. Key differences:

  • Catalog parameter is now a literal identifier (not a wildcard pattern) per JDBC spec
  • Methods that threw exceptions for null/empty inputs now return empty result sets
  • getFunctions now works (was broken via native Thrift RPC)
  • Result columns return stored values (lowercase) instead of preserving input case

To revert: set UseQueryForMetadata=0 in the connection string.

Readiness

Test plan

  • Comparator analysis validates parity between SHOW commands and native RPCs
  • Full unit test suite passes
  • Integration tests pass with UseQueryForMetadata=1 (default)

This pull request was AI-assisted by Isaac.

gopalldb and others added 17 commits April 8, 2026 11:49
- Drop Windows from cache warmer matrix — Windows runners in
  databricks-protected-runner-group lack bash (command not found)
- Remove runner.os from cache key — Maven JARs/POMs are platform-
  independent, so one cache entry serves both Linux and Windows
- Cache key is now: maven-deps-{hash(pom.xml)}

Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Thrift-mode metadata operations now use SQL SHOW commands by default
instead of native Thrift RPCs, aligning behavior with SEA mode for
seamless protocol switching.

Key behavioral changes:
- Catalog parameter treated as literal identifier (not wildcard pattern)
- Null/empty edge-case inputs return empty ResultSet (not exceptions)
- getFunctions works correctly (was broken via native Thrift RPC)
- Result columns return stored values (lowercase)

To revert: set UseQueryForMetadata=0 in connection string.

Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Comment thread NEXT_CHANGELOG.md Outdated
- Added AI coding agent detection to the User-Agent header. When the driver is invoked by a known AI coding agent (e.g. Claude Code, Cursor, Gemini CLI), `agent/<product>` is appended to the User-Agent string.

### Updated
- **[Breaking Change]** Thrift-mode metadata operations (`getTables`, `getColumns`, `getSchemas`, `getFunctions`, `getPrimaryKeys`, `getImportedKeys`, `getCrossReference`) now use SQL SHOW commands by default instead of native Thrift RPCs, aligning behavior with SEA mode. The `UseQueryForMetadata` connection property default changed from `0` to `1`. To revert to native Thrift RPCs, set `UseQueryForMetadata=0`. Key behavioral changes:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use StatementExecAPI instead of SEA

Copy link
Copy Markdown
Collaborator

@msrathore-db msrathore-db left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

SHOW commands are now the default for metadata operations on SQL
Warehouses. All-Purpose Clusters continue using native Thrift RPCs.

Logic: if user explicitly sets UseQueryForMetadata, honour their
choice for any compute type. If not set, default to SHOW commands
for warehouses and native RPCs for clusters.

Tests added:
- ConnectionContext: 4 tests covering warehouse/cluster x default/explicit
- Session: 2 tests for default metadata client selection per compute type

Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
EnableMultipleCatalogSupportIntegrationTests uses a fake Thrift server
with binary protocol stubs that match on exact session handles. With
UseQueryForMetadata=1, metadata operations go through SQL execution
(TExecuteStatementReq with SHOW commands) which can't be reliably
replayed because session handles differ between recording and replay.

Fix: explicitly set UseQueryForMetadata=0 since these tests validate
enableMultipleCatalogSupport behavior, not the SHOW commands path.

Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
@gopalldb gopalldb force-pushed the feature/use-query-for-metadata-default branch from 23c6a50 to 9490337 Compare April 21, 2026 12:55
@gopalldb gopalldb enabled auto-merge (squash) April 21, 2026 12:57
@gopalldb gopalldb disabled auto-merge April 21, 2026 14:17
@gopalldb gopalldb merged commit d14c297 into databricks:main Apr 21, 2026
14 of 15 checks passed
gopalldb added a commit to gopalldb/databricks-jdbc that referenced this pull request Apr 27, 2026
)

## Summary
Change the default value of `UseQueryForMetadata` from `0` to `1`,
making SQL SHOW commands the default for Thrift-mode metadata operations
instead of native Thrift RPCs. This aligns Thrift metadata behavior with
SEA mode for seamless server-side protocol switching.

## Breaking Change
This is a **breaking change** for users who depend on Thrift-native
metadata behavior. Key differences:
- Catalog parameter is now a literal identifier (not a wildcard pattern)
per JDBC spec
- Methods that threw exceptions for null/empty inputs now return empty
result sets
- `getFunctions` now works (was broken via native Thrift RPC)
- Result columns return stored values (lowercase) instead of preserving
input case

**To revert:** set `UseQueryForMetadata=0` in the connection string.

## Readiness
- Comparator analysis complete (Apr 8-16, 2026) — all gaps resolved
- Merged PRs: databricks#1387 (GEOMETRY/GEOGRAPHY types), databricks#1388 (VARIANT
className), databricks#1390 (null key params), databricks#1411 (case-sensitive cross
reference filter)

## Test plan
- [x] Comparator analysis validates parity between SHOW commands and
native RPCs
- [ ] Full unit test suite passes
- [ ] Integration tests pass with UseQueryForMetadata=1 (default)

This pull request was AI-assisted by Isaac.

---------

Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
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.

3 participants