Skip to content
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

Add Databricks profile #2339

Merged
merged 8 commits into from
Feb 26, 2024
Merged

Add Databricks profile #2339

merged 8 commits into from
Feb 26, 2024

Conversation

anthonysena
Copy link
Collaborator

@anthonysena anthonysena commented Jan 23, 2024

Per feedback from @konstjar, I've added a new profile "webapi-databricks" to use the Databricks JDBC Driver reference. Some notes on this PR:

  • Using the latest Databricks driver (v2.6.36) was problematic in Apache Tomcat 8.5.x. When using this driver, the servlet container would crash and WebAPI failed to start. v2.6.34 did not exhibit this behavior hence that is why it is referenced in the pom.xml
  • Added com.databricks.client.jdbc.Driver to the list of supported drivers to support this newer JDBC driver.

@anthonysena anthonysena linked an issue Jan 23, 2024 that may be closed by this pull request
@anthonysena anthonysena requested a review from konstjar January 30, 2024 14:30
pom.xml Outdated Show resolved Hide resolved
@anthonysena
Copy link
Collaborator Author

From discussion with @konstjar on the Atlas WG call, we decided to create a "webapi-databricks" profile and retain the "webapi-spark" profile for backwards compatibility. I'll revise this PR accordingly.

@anthonysena anthonysena changed the title Update Spark driver Add Databricks profile Jan 30, 2024
@konstjar
Copy link
Contributor

konstjar commented Feb 1, 2024

@anthonysena

My filling is that it is not enough to add the profile.

There are few places in WebAPI where we have some custom logic for Spark dialect:
https://github.com/OHDSI/WebAPI/blob/master/src/main/java/org/ohdsi/webapi/cohortcharacterization/DropCohortTableListener.java#L52

if (stmt.getConnection().getMetaData().getURL().startsWith("jdbc:spark")) {



if (source.getSourceDialect().equals("spark")) {

I think that we should add "jdbc:databricks" handling there. In the past we had few issues with Characterization and Pathway analysis executions.

@anthonysena
Copy link
Collaborator Author

Thanks @konstjar - you've raised some important points here with respect to the code base and the "spark" profile.

Recalling our conversation on the Atlas WG call, I thought that we wanted to adopt the "databricks" profile since some users may be using the "spark" driver which may target an older build of Apache Spark for Databricks while others may need the newer driver? When setting up the new or old Spark data source in Atlas/WebAPI, the source would be configured with the dbms == "spark" but the connection string might differ based on the driver. So in this way, the only check that requires extension is the one that is looking at the JDBC connection string, correct? In that case we can have a static method to detect the dialect based on either "databricks" or "spark" in the JDBC connection string and that would work?

@anthonysena
Copy link
Collaborator Author

@konstjar - I've updated this PR with the idea that when a person configures a data source to use spark/databricks, they would create the entry in the source table with the dialect == spark and for the connection string they could either provide the jdbc:spark or jdbc:databricks connection details. So, the checks in the code that you pointed out earlier in this PR remain the same with the exception of the one that checks the connection string details. I've modified this to check both jdbc URL formats and that should hopefully handle backwards compatibility. If you agree, this should be ready to merge.

@konstjar
Copy link
Contributor

@anthonysena Looks good to me.

@anthonysena
Copy link
Collaborator Author

Thanks @konstjar - can you approve the PR then?

@konstjar konstjar self-requested a review February 26, 2024 20:17
Copy link
Contributor

@konstjar konstjar left a comment

Choose a reason for hiding this comment

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

LGTM

@anthonysena anthonysena merged commit d90d653 into master Feb 26, 2024
2 checks passed
@delete-merged-branch delete-merged-branch bot deleted the spark-driver-update branch February 26, 2024 20:18
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.

Unclear spark/databricks support
2 participants