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

Mimic Spark driver with Databricks #421

Open
wants to merge 6 commits into
base: remove-hikari-cp
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions engine/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -570,13 +570,13 @@
<properties>
<spark.enabled>true</spark.enabled>
<!-- Spark JDBC driver path -->
<spark.classpath>/spark</spark.classpath>
<spark.classpath>/databricks</spark.classpath>
</properties>
<dependencies>
<dependency>
<groupId>com.simba</groupId>
<artifactId>spark</artifactId>
<version>2.6.22.1040</version>
<groupId>com.databricks</groupId>
<artifactId>client</artifactId>
<version>2.6.40.1071</version>
</dependency>
</dependencies>
<build>
Expand All @@ -593,11 +593,11 @@
<goal>install-file</goal>
</goals>
<configuration>
<groupId>com.simba</groupId>
<artifactId>spark</artifactId>
<version>2.6.22.1040</version>
<groupId>com.databricks</groupId>
<artifactId>client</artifactId>
<version>2.6.40.1071</version>
<packaging>jar</packaging>
<file>${spark.classpath}/spark-2.6.22.1040.jar</file>
<file>${spark.classpath}/DatabricksJDBC42.jar</file>
</configuration>
</execution>
</executions>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,14 @@ public static Connection getConnectionWithAutoCommit(DataSourceUnsecuredDTO data
if (dataSource.getType().equals(DBMSType.SNOWFLAKE)) {
info.put("CLIENT_RESULT_COLUMN_CASE_INSENSITIVE", "true");
}

// Set the Databricks JDBC driver to mimic Spark's behavior
if (dataSource.getType().equals(DBMSType.SPARK)) {
info.put("driver", "com.databricks.client.jdbc.Driver");
// Replace "spark" with "databricks" in the URL
url = url.replace("spark", "databricks");
}

Connection conn = DriverManager.getConnection(url, info);

return conn;
Expand Down