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 binding 流程,從 preparedStatement.getParameterSchema() 到 binding 前使用的 TypedValues。驗證對 null 或空 schema 以及個別 NullType 欄位的處理,並在每個參數 schema 欄位都從對應的 TypedValue 型別推導出來時顯示補全。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
java
領域
api
Issue 類型
功能
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。