flight-sql-jdbc-driver: add option to rely on Arrow Flight SQL Bulk Ingestion for batched inserts

未关闭
#931 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
5/5
预计耗时
一周以上
新手友好度
35/100
Issue 类型
功能
描述清晰度
需要澄清
活跃度
停滞
技术栈
java
领域
database

调研方向

首先检查 JDBC 驱动程序的 prepared statement 更新路径和 Flight SQL Bulk Ingestion RPC,尤其是 DoPut(CommandStatementIngest) 和 ActionCreatePreparedStatementRequest。定义一个选项如何识别符合条件的仅插入批处理语句,并通过 bulk ingestion 对其进行路由,同时兼容其他 prepared statement。

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

描述

Type: enhancement
Describe the enhancement requested

Arrow Flight SQL has a feature for ingesting massive datasets, Bulk Ingestion: https://github.com/apache/arrow/issues/38255
It would be beneficial to use those special RPC methods for batched prepared statement calls when the prepared statement is strictly for inserting data.
E.g. when Spark is used for writing data, it generates a simple SQL query like "INSERT INTO table(field1, field2, ...) VALUES (?, ?, ...)", creates a prepared statement, and then uses the prepared statement update RPC method to insert the rows of the dataset. If this feature is implemented, it would be possible for the driver to instead use the DoPut(CommandStatementIngest) command associated with the Bulk Ingestion feature instead.

There are Arrow Flight SQL server implementations that work like this: when a DoAction(ActionCreatePreparedStatementRequest) is executed, the server creates up to two versions of the data structure underlying the instance of the PreparedStatement. One is a handle to a full-scale query engine execution procedure (e.g. DataFusion's logical plan), and another is a handle to a very simple procedure that just stores the received record batches in the storage - of course, the second procedure is only possible to be generated when the query is of a certain form; like the one used by Spark. The point is that this simple procedure also works without overheads associated with the more general interface of prepared statement API - for example, it does not need to do a transposition of PreparedStatement parameters into record batches.
I think that it should be possible to move this logic for deciding to use Bulk Ingestion into the jdbc driver.

Usecase for this integration is this: developers of Arrow Flight SQL servers could implement bulk ingestion command handlers and avoid implementing special logic for handling batched inserts in a special manner. Then the client would use this newly introduced driver option to allow the driver to decide to use the bulk ingestion RPC methods for inserting data.

主要语言
Java
星标
95
派生
154
平均合并
2 天 10 小时
30 天内合并 PR
11

贡献指南

打开贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

apache/arrow-java 的其他 Issue

查看 apache/arrow-java 的全部 Issue

相似的 Issue

更多 Java Issue

把新 issue 发到你的邮箱

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