Skip to content

Conversation

msrathore-db
Copy link
Collaborator

@msrathore-db msrathore-db commented Sep 26, 2025

Description

Added support for the connection param of enableMultipleCatalogSupport.
The default value is kept to 1.
The behaviour remains the same when the param is enabled. When the param
is disabled, the behaviour is as follows:

  • getCatalogs() returns only the current catalog
  • Metadata operations are done on the current catalog
  • setCatalog() method does nothing (doesn't execute USE CATALOG)
  • The SQL query of USE CATALOG can still be executed.

To maintain the current catalog, we make the query to get the current
catalog everytime when this param is disabled.

Testing

Additional Notes to the Reviewer

PECOBLR-938

@msrathore-db msrathore-db merged commit 512026e into databricks:main Oct 9, 2025
12 of 13 checks passed
String benchfoodHost = getDatabricksBenchfoodHost();
if (benchfoodHost != null && !benchfoodHost.isEmpty()) {
String fullUrl =
benchfoodHost.startsWith("http") ? benchfoodHost : "https://" + benchfoodHost;
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit : Can we remove being too specific to benchfood in the naming across this file? (similar to dogfood in other files)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Made the change. Thanks

List<List<Object>> singleCatalogRows = new ArrayList<>();
List<Object> catalogRow = new ArrayList<>();
catalogRow.add(currentCatalog);
singleCatalogRows.add(catalogRow);
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit : reuse line on 82

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sure thanks.

ENABLE_METRIC_VIEW_METADATA("EnableMetricViewMetadata", "Enable metric view metadata", "0");

ENABLE_METRIC_VIEW_METADATA("EnableMetricViewMetadata", "Enable metric view metadata", "0"),
ENABLE_MULTIPLE_CATALOG_SUPPORT(
Copy link
Collaborator

Choose a reason for hiding this comment

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

Should we add this inDatabricksDriverPropertyUtil parameters too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Yes thanks.

}

private boolean isMultipleCatalogSupportDisabled() {
return sdkClient.getConnectionContext() != null
Copy link
Collaborator

Choose a reason for hiding this comment

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

follow the google function placement in this file. See this for more info : https://docs.google.com/document/d/1Ov6nGADV0TYI5DrbdALlAmL-SZZ_4AowGP1x1gMgJwE/edit?tab=t.0#heading=h.93vjlqf53xh7

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

private String autoFillCatalog(String catalog, IDatabricksSession session) throws SQLException {
if (isMultipleCatalogSupportDisabled()) {
String currentCatalog = session.getCurrentCatalog();
return (currentCatalog != null && !currentCatalog.isEmpty()) ? currentCatalog : "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

any reason this isn't a util?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

The change is very specific to this file. It won't be used for other files so I've just kept it here

if (isMultipleCatalogSupportDisabled()) {
String currentCatalog = session.getCurrentCatalog();
if (currentCatalog == null || currentCatalog.isEmpty()) {
currentCatalog = "";
Copy link
Collaborator

Choose a reason for hiding this comment

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

why check for empty if you have to assign an empty anyway

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated. Thanks

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