apache / apache/arrow-java

[Java][FlightRPC] Handle binding parameters when server can't provide the expected type

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

描述

### Describe the enhancement requested

Based on apache/arrow-java#156, we need to support the case where the server can't specify the expected type of a given parameter.

> Not all servers can always provide an accurate type for bind parameters. What should we do there? Note that ADBC uses NA/NullType as a wildcard/placeholder type here. This isn't specified in Flight SQL itself, but perhaps we could adopt that convention as well.

Proposal:
- When the server doesn't know the type of any of the parameters, it can just set the parameter schema to `null` (or alternatively, an empty schema).
- When the server doesn't know the type of only some of the parameters, it can just set the respective Field to `NullType`.
- Before we start binding values, we transform the `preparedStatement.getParameterSchema()` based on the types of the given `TypedValues`. If the Schema is empty/null, we create every Field for the schema based on the TypedValue type. Otherwise, we replace all NullType fields with a Field based on the TypedValue.

The only potential drawback I see with this approach is that NullTypes can't be used for parameters. That being said, I can't really think of a case why one would want to do that.

### Component(s)

Java

贡献指南

打开贡献指南

调研方向

首先,跟踪 FlightRPC 的 prepared statement 绑定流程,从 preparedStatement.getParameterSchema() 到绑定前使用的 TypedValues。验证对 null 或空 schema 以及单个 NullType 字段的处理,并在每个参数 schema 字段都从对应的 TypedValue 类型推导出来时显示补全。

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

评估

技术栈
java
领域
api
Issue 类型
功能
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

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