-
Notifications
You must be signed in to change notification settings - Fork 21
Added support for enableMultipleCatalogSupport param #1025
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
src/main/java/com/databricks/jdbc/dbclient/impl/sqlexec/DatabricksMetadataSdkClient.java
Show resolved
Hide resolved
src/main/java/com/databricks/jdbc/dbclient/impl/thrift/DatabricksThriftServiceClient.java
Outdated
Show resolved
Hide resolved
src/main/java/com/databricks/jdbc/dbclient/impl/thrift/DatabricksThriftServiceClient.java
Show resolved
Hide resolved
…ipleCatalogSupport is disabled. Same behaviour as thrift
String benchfoodHost = getDatabricksBenchfoodHost(); | ||
if (benchfoodHost != null && !benchfoodHost.isEmpty()) { | ||
String fullUrl = | ||
benchfoodHost.startsWith("http") ? benchfoodHost : "https://" + benchfoodHost; |
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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 : ""; |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 = ""; |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated. Thanks
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:
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