apache / apache/arrow-java

[Java] Some questions about the metadata api of jdbc

Open
#180 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
94
Forks
152
Avg merge
3d 16h
Merged PRs (30d)
11

Description

### Describe the usage question you have. Please include as many useful details as possible.

When I call the `getTables` interface, I get an error
```
java.sql.SQLException: Failed to transform VectorSchemaRoot.

at org.apache.arrow.driver.jdbc.ArrowFlightJdbcFlightStreamResultSet.executeForCurrentFlightStream(ArrowFlightJdbcFlightStreamResultSet.java:150)
at org.apache.arrow.driver.jdbc.ArrowFlightJdbcFlightStreamResultSet.execute(ArrowFlightJdbcFlightStreamResultSet.java:139)
at org.apache.arrow.driver.jdbc.ArrowFlightJdbcFlightStreamResultSet.fromFlightInfo(ArrowFlightJdbcFlightStreamResultSet.java:105)
at org.apache.arrow.driver.jdbc.ArrowDatabaseMetadata.getTables(ArrowDatabaseMetadata.java:902)
```

My server returns the result as follows
```
SELECT
TABLE_TENANT as TABLE_CAT,
TABLE_DATABASE as TABLE_SCHEM,
TABLE_NAME,
TABLE_TYPE
FROM
INFORMATION_SCHEMA.TABLES
WHERE TABLE_TENANT = 'cnosdb' AND TABLE_DATABASE LIKE 'public' AND TABLE_NAME LIKE '%' AND TABLE_TYPE IN ('TABLE')
ORDER BY
TABLE_TYPE, TABLE_CAT, TABLE_SCHEM, TABLE_NAME
```

By the code, I found that

- Convert `catalog_name` to `TABLE_CAT` in the `ArrowDatabaseMetadata.getCatalogs` api.
- Convert `db_schema_name` to `TABLE_SCHEM` in the `ArrowDatabaseMetadata.getSchemas` api.
- ......

For the above, can I think that the ResultSet Schema of my `getSchemas` implementation must be `db_schema_name`, `catalog_name` instead of `TABLE_SCHEM`, `TABLE_CATALOG`. The same goes for other API?

### Component(s)

Java

Contributor guide

Open the contributing guide

Research direction

Start in ArrowDatabaseMetadata.getTables, getSchemas, and getCatalogs, then trace the schema transformation in ArrowFlightJdbcFlightStreamResultSet.executeForCurrentFlightStream. Compare the returned columns with the JDBC metadata contract and identify why the getTables result cannot be transformed. Done means documenting the expected schema and a confirmed resolution path.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
api, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.