apache / apache/arrow-java

Bug Report: Column Nullability Not Honored in FlightSqlProducer Schema

未关闭
#782 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
Type: bug
主要语言
Java
星标
94
派生
152
平均合并
3 天 16 小时
30 天内合并 PR
11

描述

### Describe the bug, including details regarding any error messages, version, and platform.

In the FlightSqlProducer class, the getFlightInfoPreparedStatement method is responsible for returning the Arrow Schema of the ResultSet for a given query. However, the returned schema does not accurately reflect the nullability of columns. Regardless of whether a column is defined as nullable or non-nullable, the schema always returns a fixed nullability value.

This leads to incorrect ResultSetMetaData when the schema is consumed via the Flight SQL driver.

Root Cause:

The issue originates in the method:

`org.apache.arrow.driver.jdbc.utils.ConvertUtils.convertArrowFieldsToColumnMetaDataList()`

Here, a list of `org.apache.arrow.vector.types.pojo.Field` objects is converted into `org.apache.calcite.avatica.ColumnMetaData` instances. However, the `setNullable` property of the `ColumnMetaData.Builder` is not being set based on the actual nullability of the Arrow field.

Expected Behavior:

The `setNullable` method of `ColumnMetaData.Builder` should be updated to reflect the value of `field.isNullable()` from the Arrow schema.

Impact:

This bug results in incorrect metadata being exposed to clients using the Flight SQL driver, potentially leading to misinterpretation of the data schema.

贡献指南

打开贡献指南

调研方向

从 org.apache.arrow.driver.jdbc.utils.ConvertUtils.convertArrowFieldsToColumnMetaDataList() 开始,该方法会将 Arrow Field 对象转换为 Flight SQL 驱动程序的 ColumnMetaData 实例。检查 ColumnMetaData.Builder 的填充方式,并验证生成的元数据是否保留每个字段的 nullability。nullable 和 non-nullable 的 Arrow 字段能够公开匹配的 ResultSetMetaData 值即表示完成。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
databases
Issue 类型
缺陷
难度
2/5
预计耗时
1-3 小时
活跃度
停滞
描述清晰度
描述清楚
新手友好度
55/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。