Skip to content

Conversation

@pan3793
Copy link
Member

@pan3793 pan3793 commented Oct 23, 2025

What changes were proposed in this pull request?

This is the initial implementation of the Connect JDBC driver. In detail, this PR implements the essential JDBC interfaces listed below.

  • java.sql.Driver
  • java.sql.Connection
  • java.sql.Statement
  • java.sql.ResultSet
  • java.sql.ResultSetMetaData
  • java.sql.DatabaseMetaData

At the first step, this PR only supports NullType, BooleanType, ByteType, ShortType, IntegerType, LongType, FloatType, DoubleType, and StringType.

Why are the changes needed?

Basically implement the feature proposed in SPIP: JDBC Driver for Spark Connect

Does this PR introduce any user-facing change?

It's a new feature.

How was this patch tested?

New UTs are added.

And I have also cross-verified BeeLine cases with SPARK-54002 (#52706)

Was this patch authored or co-authored using generative AI tooling?

No.

@pan3793
Copy link
Member Author

pan3793 commented Oct 23, 2025

Comment on lines +89 to +90
case FloatType => 14
case DoubleType => 24
Copy link
Member Author

Choose a reason for hiding this comment

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

test("get DatabaseMetaData from SparkConnectConnection") {
withConnection { conn =>
val spark = conn.asInstanceOf[SparkConnectConnection].spark
val metadata = conn.getMetaData
Copy link
Member Author

@pan3793 pan3793 Oct 23, 2025

Choose a reason for hiding this comment

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

Note: there are nearly 200 methods defined in DatabaseMetaData interface, in this Initial implementation, I only implemented some essential methods which is no ambiguity or required by BeeLine to work. The remaining methods will be implemented in subsequent PRs.


package org.apache.spark.sql.connect.client.jdbc.util

import java.sql.{Array => _, _}
Copy link
Member

Choose a reason for hiding this comment

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

Shall we simply import Connection and ResultSet?

Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

+1, LGTM. Thank you for making a progress on this, @pan3793 .

Merged to master to unblock the remaining dependent PRs. We can revise and polish more while developing this further.

@pan3793
Copy link
Member Author

pan3793 commented Oct 24, 2025

@dongjoon-hyun thanks for quick review and merging, subsequent PRs will be submitted soon

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants