GitHub user ankursaini2006 created a discussion: DBC Driver returns missing 
COLUMN_SIZE in DatabaseMetaData.getColumns() for VARCHAR columns mapped from 
Spark/Hive STRING

### Problem Description

When querying tables or inspecting metadata through the Kyuubi JDBC driver 
using third-party JDBC frameworks (specifically Trino's JDBC connector), 
operations fail with the following exception:

java.lang.IllegalStateException: column size not present

### Root Cause & Investigation

1. In JDBC connector frameworks like Trino's 
`BaseJdbcClient.toColumnMapping()`, when mapping `Types.VARCHAR` (JDBC type 
code `12`), it calls `JdbcTypeHandle.getRequiredColumnSize()`.
2. This expects `COLUMN_SIZE` in `DatabaseMetaData.getColumns()` (or 
`ResultSetMetaData.getPrecision()`) to be populated.
3. Because the underlying engine column type is Spark/Hive `STRING` (which has 
no defined length bound), the Kyuubi JDBC driver reports the JDBC data type as 
`12` (`VARCHAR`), but leaves `COLUMN_SIZE` `null` or unpopulated.
4. Downstream consumers expecting a standard `VARCHAR` column size fail with a 
null/missing field error instead of treating it as unbounded.

### Question for the Community

- Should Kyuubi's JDBC driver or server return a default fallback `COLUMN_SIZE` 
(e.g., `Integer.MAX_VALUE` or a configurable max length) for Spark/Hive 
unbounded `STRING` types mapped to `VARCHAR`?
- Is there an existing configuration or ongoing fix in recent Kyuubi releases 
to handle missing column sizes for string fields in `DatabaseMetaData`?

GitHub link: https://github.com/apache/kyuubi/discussions/7629

----
This is an automatically sent email for [email protected].
To unsubscribe, please send an email to: 
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to