apache / apache/arrow-java

Expose Arrow `Struct` columns as JDBC `STRUCT` metadata in the Flight SQL JDBC driver.

Aperta Adatta ai principianti
#1,100 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Type: enhancement
Lingua principale
Java
Stelle
94
Fork
152
Merge medio
3g 16h
PR unite (30g)
11

Descrizione

### Describe the enhancement requested

Please expose Arrow `Struct` columns as JDBC `STRUCT` metadata in the Flight SQL JDBC driver.

Today, Arrow `Struct` is mapped to `java.sql.Types.JAVA_OBJECT`, which makes
`ResultSetMetaData` report:
- `getColumnType(...) == Types.JAVA_OBJECT`
- `getColumnTypeName(...) == "JAVA_OBJECT"`

This hides the fact that the column is structurally a JDBC `STRUCT`, even though the driver
already has struct-specific accessor support.

## Why this matters

JDBC clients often rely on `ResultSetMetaData` to understand result schemas before reading
rows. When `STRUCT` columns are reported as `JAVA_OBJECT`, clients cannot distinguish:
- struct/object-like columns
- generic opaque objects

This makes schema inspection, BI tooling, ORM adapters, and generic JDBC consumers harder.

## Current upstream evidence

In
`flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/SqlTypes.java`:

- `ArrowType.Struct` maps to `Types.JAVA_OBJECT`

In `flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/accessor/impl/comple
x/ArrowFlightJdbcStructVectorAccessor.java`:

- `getStruct()` is already implemented
- but `getObjectClass()` returns `Map.class`
- `getObject()` returns a `Map`

So the data path knows about structs, but metadata does not expose them as JDBC `STRUCT`.

## Expected behavior

For Arrow `Struct` columns:
- `ResultSetMetaData.getColumnType(...)` should return `java.sql.Types.STRUCT`
- `ResultSetMetaData.getColumnTypeName(...)` should return `STRUCT`

Optionally, `getObject()` / object-class behavior could also be aligned with JDBC `Struct`, but
the most important gap is metadata.

## Actual behavior

Arrow `Struct` columns are exposed as:
- `Types.JAVA_OBJECT`
- `"JAVA_OBJECT"`

## Version

Observed with:
- Arrow Flight SQL JDBC driver `18.2.0`

Confirmed in current upstream code and latest published artifact line:
- `19.0.0`

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia in flight/flight-sql-jdbc-core/src/main/java/org/apache/arrow/driver/jdbc/utils/SqlTypes.java, dove ArrowType.Struct è mappato su Types.JAVA_OBJECT, e rivedi l’implementazione correlata di ArrowFlightJdbcStructVectorAccessor.java. Aggiorna la mappatura dei metadati in modo che le colonne Struct riportino JDBC STRUCT e verifica che ResultSetMetaData restituisca STRUCT e "STRUCT" per tali colonne.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
java
Ambito
database
Tipo di issue
Funzionalità
Difficoltà
2/5
Tempo stimato
1-3 ore
Stato di attività
Tranquilla
Chiarezza
Specificata chiaramente
Idoneità per principianti
76/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.