feat(jdbc): JdbcExporter, matching the CSV and Parquet exporters
维护者通常 1 天内回复
还没有人认领这个 Issue。
评估
调研方向
Start by comparing the existing JdbcImporter and JdbcImportOptions with the CSV and Parquet exporter APIs to locate the JDBC module’s conventions. Then review the import type mapping and exporter progress listener patterns before defining the export API and binder behavior. Done means exporting rows into a caller-provided table in batches with validity-aware nulls, transaction rollback on failure, restored auto-commit, and opt-in DDL support.
由索引模型根据 Issue 内容生成。
描述
vortex-jdbc only has JdbcImporter/JdbcImportOptions; csv and parquet each have an importer and an exporter. Add JdbcExporter + JdbcExportOptions for symmetry: read a Vortex file and move its rows into a table in a JDBC database over a caller-supplied Connection.
API sketch
JdbcExportOptions opts = JdbcExportOptions.defaults()
.withBatchSize(5_000)
.withBinder(JdbcBinder.standard()
.with(DType.Extension.class, (ps, i, value) -> ps.setObject(i, value)));
JdbcExporter.export(vortexPath, connection, "ohlc", opts);
- Options are a final class with a private constructor,
defaults()andwithXxxcopies, as everywhere else. The target table is a required argument ofexport, not an option (confirm thatCsvExporter/ParquetExportertake their target the same way). - Binder (callback): a small functional interface that sets one value on a
PreparedStatement.JdbcBinder.standard()covers primitives, strings, decimals, booleans and dates. A user overrides only the types their database needs special handling for (Postgres arrays,setObjectfor timestamps). - DDL helper, not automatic: a
DTypeto SQL type function pluscreateTableSql(name, dtype)returns aCREATE TABLEstring. The exporter never creates or alters a table on its own; creation is opt-in.
Behavior
- Appends to an existing table with
INSERT INTO t (cols...) VALUES (?, ...)through aPreparedStatement. Nulls follow the validity mask. - One transaction for the whole export: remember the connection's auto-commit setting,
setAutoCommit(false),addBatch()per row,executeBatch()everybatchSizerows,commit()at the end,rollback()and rethrow on failure, and restore auto-commit in afinally. The connection belongs to the caller. A failed export leaves nothing behind. ProgressListener, as in the other exporters.
Open design questions
- Reverse type mapping
DTypeto SQL type (the inverse ofSqlTypeToDType); it varies by database. - Create-if-missing vs truncate vs fail-if-exists: all opt-in, append is the default.
- A
withCommitEvery(n)option for very large exports, if a long-lived transaction proves a problem. Not in the first cut.
Not needed for the jdbc:vortex: driver work (#566). No demand yet, so this waits until someone needs it.
- 主要语言
- Java
- 星标
- 3
- 派生
- 2
- 平均合并
- 9 小时 47 分钟
- 30 天内合并 PR
- 128
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 没有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
dfa1/vortex-java 的其他 Issue
-
bug
难度 2/5 1-3 小时 新手友好度 66/100
dfa1/vortex-java#636 ·
维护者通常 1 天内回复
-
bug
难度 3/5 1-2 天 新手友好度 70/100
dfa1/vortex-java#655 ·
维护者通常 1 天内回复
-
perf
难度 4/5 3-5 天 新手友好度 30/100
dfa1/vortex-java#651 ·
维护者通常 1 天内回复
-
Writer: string columns written as per-chunk dicts where Rust uses its dict layout (up to 2x larger)未关闭perf
难度 4/5 3-5 天 新手友好度 30/100
dfa1/vortex-java#650 ·
维护者通常 1 天内回复
-
perf
难度 4/5 3-5 天 新手友好度 28/100
dfa1/vortex-java#649 ·
维护者通常 1 天内回复
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 72/100
维护者通常 3 天内回复
-
A proxy that fails to start logs a RejectedExecutionException stack trace from its shutdown hook未关闭follow-up
难度 2/5 1-3 小时 新手友好度 62/100
Sanne/incus-spawn#1953 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 72/100
atlassian/data-center-helm-charts#1170 ·
维护者通常 1 天内回复
-
Bug
难度 2/5 1-3 小时 新手友好度 70/100
维护者通常 1 天内回复
-
Issue: Bug
难度 2/5 1-3 小时 新手友好度 62/100
OpenAPITools/openapi-generator#25524 ·
维护者通常 1 天内回复