Skip to content

Add server-side SAFE flag for UseQueryForMetadata rollout on DBSQL#1437

Open
gopalldb wants to merge 7 commits intodatabricks:mainfrom
gopalldb:feature/server-side-use-query-for-metadata-flag
Open

Add server-side SAFE flag for UseQueryForMetadata rollout on DBSQL#1437
gopalldb wants to merge 7 commits intodatabricks:mainfrom
gopalldb:feature/server-side-use-query-for-metadata-flag

Conversation

@gopalldb
Copy link
Copy Markdown
Collaborator

@gopalldb gopalldb commented May 5, 2026

Summary

Adds support for server-side SAFE flag enableUseQueryForThriftJdbc to control the SHOW commands rollout for Thrift metadata operations on DBSQL warehouses.

Priority order (matches UseThriftClient pattern):

  1. Client-side param (UseQueryForMetadata in JDBC URL) — honoured first, unconditionally
  2. Server-side SAFE flag (enableUseQueryForThriftJdbc) — checked for DBSQL warehouses only
  3. Default (0 = disabled)

Examples:

UseQueryForMetadata in URL Server flag Compute Result
1 any any SHOW commands enabled
0 any any SHOW commands disabled
not set enabled DBSQL warehouse SHOW commands enabled
not set disabled DBSQL warehouse SHOW commands disabled
not set any All-purpose cluster SHOW commands disabled

Code changes:

  • Added resolveFeatureFlag(clientParam, serverFlagName) helper in DatabricksConnectionContext — reusable for future client-first/server-fallback patterns
  • Refactored useQueryForMetadata() to use the new helper

Test plan

  • DatabricksConnectionContextTest — 110 tests pass
  • DatabricksSessionTest — 18 tests pass
  • Formatting clean

NO_CHANGELOG=true

This pull request was AI-assisted by Isaac.

Add support for server-side feature flag
enableUseQueryForThriftJdbc to control SHOW commands rollout
for Thrift metadata operations on DBSQL warehouses.

Priority order:
1. Client-side param (UseQueryForMetadata in JDBC URL) — honoured first
2. Server-side SAFE flag (DBSQL warehouses only)
3. Default value (0 = disabled)

Extract resolveFeatureFlag() helper for client-first, server-fallback
pattern reusable across similar feature flags.

Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
@gopalldb gopalldb force-pushed the feature/server-side-use-query-for-metadata-flag branch from 01c5eb5 to c492b92 Compare May 5, 2026 05:03
@gopalldb gopalldb requested a review from vikrantpuppala May 5, 2026 09:13
5 tests covering all priority combinations:
- Server flag enabled on warehouse → true
- Server flag disabled on warehouse → false
- Server flag enabled on cluster → ignored (false)
- Client explicit=1 overrides server disabled → true
- Client explicit=0 overrides server enabled → false

Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
gopalldb added 5 commits May 11, 2026 11:29
…warehouses

Change resolveFeatureFlag logic to:
1. User explicitly set param → honour it (any compute)
2. No explicit setting + cluster → always false
3. No explicit setting + warehouse → true only when BOTH client
   default is "1" AND server-side flag is enabled

Change UseQueryForMetadata default from "0" to "1" so the server-side
flag becomes the sole rollout gate for warehouses.

Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
- Update test comments to reflect two-key mechanism (client default + server flag)
- Add breaking change entry to NEXT_CHANGELOG.md for UseQueryForMetadata default change

Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
Document three breaking changes:
1. getTables() % catalog treated as literal, not wildcard
2. getColumnTypeName() returns base DECIMAL without precision/scale
3. DBSQL metadata operations now use SHOW commands (UseQueryForMetadata)

Co-authored-by: Isaac
Signed-off-by: Gopal Lal <gopal.lal@databricks.com>
…contamination

DatabricksDriverFeatureFlagsContextFactory uses a static ConcurrentHashMap
that persists across tests. When DatabricksConnectionContextTest sets
enableUseQueryForThriftJdbc=true, it leaks into DatabricksSessionTest,
causing useQueryForMetadata() to return true unexpectedly.

Fix: call removeInstance() in setupWarehouse() to clear stale flags.

Co-authored-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.

2 participants