You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@seatunnel.apache.org by "hutiefang76 (via GitHub)" <gi...@apache.org> on 2026/09/27 14:35:24 UTC

[PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

hutiefang76 opened a new pull request, #12498:
URL: https://github.com/apache/seatunnel/pull/12498

   ### Purpose of this pull request
   
   Closes #12497.
   
   With DuckDB JDBC 1.3.1, a 100-row `executeBatch` into DuckLake produced 100 Parquet files in a local reproduction. The JDBC sink's `batch_size` did not prevent this. This PR adds an opt-in `ducklake_bulk_write` path that stages each batch in a connection-local DuckDB temporary table, then performs one `INSERT ... SELECT` into the attached DuckLake table. The ordinary DuckDB/JDBC path remains the default.
   
   ### Does this PR introduce any user-facing change?
   
   Yes. For an existing DuckLake table, users can set `generate_sink_sql = true`, `database = "lake"`, `table = "main.events"`, and `ducklake_bulk_write = true`. An attached lake can be initialized on each JDBC connection through DuckDB's `session_init_sql_file` URL parameter; the PostgreSQL database, metadata schema, and data path are configured separately in that SQL file. The sink's dry-run connection check validates the attached target and input columns without DDL/DML.
   
   The mode is append-only and requires `schema_save_mode = IGNORE`, `data_save_mode = APPEND_DATA`, `auto_commit = true`, `max_retries = 0`, and a positive `batch_size`. It rejects custom write SQL, primary keys/upserts, COPY, and XA. A task replay after an uncertain commit can still duplicate rows; this change does not claim exactly-once delivery. English and Chinese JDBC/DuckDB docs describe the setup and limits. The DuckDB docs also remove an XA example that referred to a class absent from the pinned 1.3.1 driver.
   
   ### How was this patch tested?
   
   - JDK 17: `mvn -o -pl seatunnel-connectors-v2/connector-jdbc -am -DskipTests -q verify` passed; module Spotless applied.
   - Targeted JDK 17 tests: `DuckLakeBulkWriteTest` (3), `JdbcSinkFactoryTest` (18), and existing `DuckDBSourceAndSinkTest` (1) all passed. The opt-in DuckLake test uses the matching DuckLake and SQLite scanner extension files, compares 100 files from ordinary JDBC batching with one additional file from the SeaTunnel bulk sink, runs the dry-run check, and reads back 100 distinct rows after reconnect. The other tests cover configuration rejection, an unsuccessful transfer followed by job-style replay, and decimal/timestamptz/null values through staging.
   - Manual deployment smoke: DuckDB JDBC 1.3.1 + matching extensions attached DuckLake to an isolated PostgreSQL `lake_metadata` database with a non-public `dl_meta` metadata schema and a MinIO S3 data path. A 100-row staged insert containing nullable text, decimal, and timestamptz values yielded one Parquet object and all 100 rows were readable after reconnect. The temporary containers were removed afterward.
   
   ### Check list
   
   * [x] No new Jar binary package or connector module is added.
   * [x] English and Chinese connector documentation is updated.
   * [x] The option defaults to false, so existing DuckDB writes are unchanged.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "DanielLeens (via GitHub) via commits" <co...@seatunnel.apache.org>.
DanielLeens commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-7061698262

   Thanks, @SEZ9. I agree that the eight previously discussed source points are closed; the reported compile with `-DskipTests` is compilation evidence, not executed-test evidence. I also need to correct the earlier CI instruction: the [current Apache Build check](https://github.com/apache/seatunnel/runs/135571035436) says it cannot detect an exact-head fork Build. `ACTION_REQUIRED` here does not by itself prove that a maintainer workflow approval is pending.
   
   Please restore Actions execution in the fork and start Build for this PR branch. If the previously reported HTTP 422 restriction persists, resolve the repository/account Actions restriction (or contact GitHub Support); an active workflow registration alone does not prove a run executed. Only an actual approval banner calls for maintainer workflow approval. No unrelated source/dependency patch or blind sync is indicated by this signal. Once the exact-head run completes, Apache must adopt its result.
   
   Checked unchanged head `afda574422455c42dd23f5dc2f77f3fb12a5c151` against `dev`: compare `diverged`, ahead 11 / behind 45. This drift is recorded independently; it does not by itself request synchronization. This is a discussion/CI follow-up, not another full source review. No local build, test or runtime execution was performed. Daniel has READ repository permission; effective maintainer approval/dismissal remains a separate repository gate. Checked 2026-11-21T12:06:29.365986+00:00.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "DanielLeens (via GitHub) via commits" <co...@seatunnel.apache.org>.
DanielLeens commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-7044552996

   Thanks for the precise clarification, @hutiefang76. I record the five starter compilation results as author-reported compilation with `-DskipTests`, not as test execution or upstream CI acceptance. My source-blocker conclusion remains cleared at unchanged head `afda574422455c42dd23f5dc2f77f3fb12a5c151`. The remaining [Apache Build check](https://github.com/apache/seatunnel/runs/135571035436) is `ACTION_REQUIRED`: a write-capable maintainer needs to approve the workflow run, then let the current-head Build complete. No source or dependency change is indicated by this approval gate, and syncing dev alone will not approve the workflow. This is a text-only follow-up; no new full review or local execution was performed.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "hutiefang76 (via GitHub)" <gi...@apache.org>.
hutiefang76 commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-5860335005

   I checked the failed Build rerun (attempt 2). The failing jobs are OceanBaseCDCCompatibilityIT on JDK 8 and 11 (`io.debezium.relational.TableId` is not serializable) and the Windows JDK 11 `PayPalClientTest.closeWakesRetryWait` timing assertion. None is in a module changed by this PR. The focused JDBC/DuckLake tests pass locally; I’m leaving those unrelated tests outside this patch.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "hutiefang76 (via GitHub)" <gi...@apache.org>.
hutiefang76 commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-5872040718

   I followed up on the inherited-key limitation in f1592357c. A normal PostgreSQL batch source can carry PK/UNIQUE metadata even when the sink has no configured keys. The new `ducklake_bulk_write_ignore_inherited_keys` option is off by default and only ignores that inherited metadata in the Sink copy. Explicit `primary_keys` and all non-INSERT rows remain rejected; source metadata is preserved.
   
   I ran actual PostgreSQL PRIMARY/UNIQUE sources through the Sink into DuckLake and reconnected to verify the rows on JDK 8 and 17. The regression also checks that duplicate keys are appended rather than deduplicated. Both versions passed 51 targeted tests and module verify; the four Markdown checks passed. This adds an explicit append-only choice, so the new head needs another look at that option and its contract.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "hutiefang76 (via GitHub) via commits" <co...@seatunnel.apache.org>.
hutiefang76 commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-6973644141

   The single-input boundary is enforced in [e9799e13](https://github.com/apache/seatunnel/commit/e9799e1385eebc099cac537b5da56a673fa398c3) before Zeta expands a multi-table source or takes the union early return. A default no-op factory hook receives the complete table count; only JDBC bulk mode rejects multiple inputs. The multi-table marker remains for ordinary JDBC routing.
   
   Both rejected shapes fail against prior production code and pass with the guard. Single-input bulk, ordinary multi-table processing and ordinary JDBC template validation remain covered. Java 11 and 17 each pass 49 unit tests and four integration tests; the two extension-dependent DuckLake tests are explicitly skipped. An unchanged Console factory binary also passes against the new default hook. The same patch also passes against current dev with all four planning integration tests.
   
   The root quick verify was attempted but remains incomplete: dependency resolution stopped in the unchanged Spark Connector V2 Example module. The fork Build dispatch currently returns HTTP 422, Actions has been disabled for this repository. No exact-head hosted Build result is claimed; the CI gate remains open.
   
   AI-assisted implementation, tests and reply: DeepSeek and OpenAI Codex.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "DanielLeens (via GitHub) via commits" <co...@seatunnel.apache.org>.
DanielLeens commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-7006908057

   Thanks @SEZ9 for the detailed current-head review. I agree that the new engine-neutral validateInputTableCount hook must enforce the single-input contract at every supported engine entry point, not only Zeta. The Flink/Spark fan-out and dry-run/sample-path evidence in your review needs to be reconciled before merge; I am not issuing a separate duplicate finding. The fork Actions execution restriction is an independent CI gate and does not resolve that source-contract concern. Please address the existing review as a whole in the next commit.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "hutiefang76 (via GitHub) via commits" <co...@seatunnel.apache.org>.
hutiefang76 commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-7039138522

   A detail on the compilation point in the re-review. The local Maven run on `afda5744` compiled the Flink 1.13, 2.0, and common starters and the Spark 2.4 and common starters. All five finished successfully in the reactor. The run used `-DskipTests`, and the upstream Build still needs to run on this head.
   
   AI-assisted wording. The compilation results are from the local Maven log.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "hutiefang76 (via GitHub)" <gi...@apache.org>.
hutiefang76 commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-5863670460

   Thanks, Daniel. I pushed the stage-lifecycle update in 328bbb63d.
   
   Each flush now drops/recreates the temporary stage and scopes both JDBC statements with try-with-resources. Writer close drops the remaining stage using a fresh statement, so a failed DuckDB INSERT cannot leave cleanup dependent on the statement it closed. The pooled connection stays open; cleanup failures retain their suppressed exceptions. I chose this lifecycle change rather than claiming flat RSS from a small workload.
   
   The failure test now keeps the target table and its existing row, rejects one row through a CHECK constraint, and checks the table immediately for partial publication. After explicitly discarding that bad batch, two more flushes verify clean reuse. I also added repeated-flush/close coverage, injected cleanup failures, and the inherited UNIQUE-key rejection case.
   
   The EN/ZH docs now cover inherited PK/UNIQUE keys, single-target scope, partial flushes and batch memory sizing. The test Javadoc and PR description state that the real DuckLake file-count check is opt-in and skipped in default CI. It ran locally here. JDK 8 and 17 each passed all 25 focused tests and module verify; Spotless passed.
   
   I kept validation at the option, factory and writer entry points because the inherited key is only known at the factory. The XA documentation correction is also tracked separately in #12505; I will remove overlap when that lands.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "hutiefang76 (via GitHub)" <gi...@apache.org>.
hutiefang76 commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-5868937272

   I pushed the documentation follow-ups in `64cdb185b`. Both languages now state that large-batch throughput and peak memory remain unmeasured, explain independent writer commits and commit failures not retried by the sink, and describe one configured target table without referring to the source-only table_list option. MarkdownTest passes.
   
   I’m keeping the inherited-key rejection and the current validation boundaries in this PR. I’ll reconcile the XA wording with #12505 when either branch lands.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "hutiefang76 (via GitHub)" <gi...@apache.org>.
hutiefang76 commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-5875719878

   Synced this branch with current dev and removed the XA documentation overlap with #12505. The bulk implementation is unchanged; JDK 8/17 each pass the 51 focused tests, and MarkdownTest passes 4/4.
   
   I also checked the staging cost through the actual SinkFactory/writer with identical generated-SQL settings in both modes, toggling only `ducklake_bulk_write`:
   
   | Setup | Rows / batch size | Ordinary / bulk time | Ordinary / bulk active files |
   | --- | --- | --- | --- |
   | SQLite metadata, local data | 2,000 / 512 | 0.858s / 0.246s | 2,000 / 4 |
   | PostgreSQL 17 metadata, MinIO | 500 / 128 | 3.673s / 0.292s | 500 / 4 |
   
   Each row included DECIMAL(18,4), a microsecond TIMESTAMPTZ and a 1KiB text value or null. A new connection read back and compared every value. Both modes added four snapshots in each listed case, so the file reduction does not change commit semantics.
   
   These are one-run smoke measurements with a fresh JVM/lake per case, not a steady-state benchmark. Whole-process RSS includes native DuckDB and readback; I am not claiming a general memory reduction or a fixed speedup. The opt-in/insert-only delivery limits remain unchanged.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [Improve][Connector-V2] Batch DuckLake JDBC writes through a temporary table [seatunnel]

Posted by "davidzollo (via GitHub) via commits" <co...@seatunnel.apache.org>.
davidzollo commented on PR #12498:
URL: https://github.com/apache/seatunnel/pull/12498#issuecomment-6886057958

   ### Implementation Notes and Trade-offs
   
   Head: `dca32defebca3d9667bae908625b4e8ddf0f4047`
   
   I synced the DuckLake JDBC branch with current `dev`. The old Build was cancelled with separate failures in PostgreSQL CDC, task execution, and Doris startup, outside the DuckLake changes. The updated base includes #12454, which fixes the PostgreSQL CDC checkpoint and LSN setup in the test that timed out. This update does not assume that every other failed job is fixed.
   
   The additions and removals in all twelve PR files are identical before and after the sync. The merge retains the contributor's existing commits and needs no duplicate test fixes or changes to DuckLake behavior. Scoped JDBC Spotless apply/check and the diff whitespace check passed. The updated head still needs a GitHub Build.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@seatunnel.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org