Skip to content

Conversation

@pan3793
Copy link
Member

@pan3793 pan3793 commented Oct 31, 2025

What changes were proposed in this pull request?

Implement getCatalogs defined in java.sql.DatabaseMetaData for SparkConnectDatabaseMetaData.

    /**
     * Retrieves the catalog names available in this database.  The results
     * are ordered by catalog name.
     *
     * <P>The catalog column is:
     *  <OL>
     *  <LI><B>TABLE_CAT</B> String {@code =>} catalog name
     *  </OL>
     *
     * @return a {@code ResultSet} object in which each row has a
     *         single {@code String} column that is a catalog name
     * @throws SQLException if a database access error occurs
     */
    ResultSet getCatalogs() throws SQLException;

Why are the changes needed?

Enhance API coverage of the Connect JDBC driver, for example, get[Catalogs|Schemas|Tables|...] APIs are used by SQL GUI tools such as DBeaver for displaying the tree category.

Does this PR introduce any user-facing change?

No, the Connect JDBC driver is a new feature under development.

How was this patch tested?

New UT is added.

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

No.

LuciferYang pushed a commit that referenced this pull request Nov 3, 2025
…taData

### What changes were proposed in this pull request?

Implement `getCatalogs` defined in `java.sql.DatabaseMetaData` for `SparkConnectDatabaseMetaData`.

```java
    /**
     * Retrieves the catalog names available in this database.  The results
     * are ordered by catalog name.
     *
     * <P>The catalog column is:
     *  <OL>
     *  <LI><B>TABLE_CAT</B> String {code =>} catalog name
     *  </OL>
     *
     * return a {code ResultSet} object in which each row has a
     *         single {code String} column that is a catalog name
     * throws SQLException if a database access error occurs
     */
    ResultSet getCatalogs() throws SQLException;
```
### Why are the changes needed?

Enhance API coverage of the Connect JDBC driver, for example, `get[Catalogs|Schemas|Tables|...]` APIs are used by SQL GUI tools such as DBeaver for displaying the tree category.

### Does this PR introduce _any_ user-facing change?

No, the Connect JDBC driver is a new feature under development.

### How was this patch tested?

New UT is added.

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

No.

Closes #52815 from pan3793/SPARK-54111.

Authored-by: Cheng Pan <chengpan@apache.org>
Signed-off-by: yangjie01 <yangjie01@baidu.com>
(cherry picked from commit 2be1eb7)
Signed-off-by: yangjie01 <yangjie01@baidu.com>
@LuciferYang
Copy link
Contributor

Merged into master/branch-4.1, thanks @pan3793

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