etl: Use ADBC bulk ingest for AdbcSink inserts#106
Merged
Conversation
Replace per-row SQL INSERT statement construction with the ADBC bulk ingest API (Statement::bind + execute_update with IngestMode::Append). This sends Arrow RecordBatch data directly to the driver without serializing each cell to a SQL literal, which is significantly faster for large batches. Tables are pre-created via the system adapter create_table RPC, so the sink always uses IngestMode::Append. The auto_create_tables flag and created_tables tracking are removed. Update and Delete operations continue to use per-row SQL as the ADBC bulk ingest API only supports append semantics.
peasee
approved these changes
Feb 19, 2026
- Add bulk_ingest_stream() to AdbcConnection using bind_stream API to send all chunks in a single ADBC statement - Increase chunk size from 65K to 500K rows to reduce round trips - Single spawn_blocking + mutex acquisition per table instead of per chunk - Eliminates per-chunk retry overhead (stream handles batching internally)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replace per-row SQL INSERT statement construction with the ADBC bulk ingest API for
AdbcSinkinsert operations. This sends ArrowRecordBatchdata directly to the driver without serializing each cell to a SQL literal.Changes
crates/adbc_client/src/lib.rsbulk_ingest()method toAdbcConnectionthat configures a statement withTargetTable,TargetDbSchema, andIngestMode, then callsbind(batch)+execute_update()adbc_core::options::IngestModefor downstream usecrates/etl/src/sink/adbc.rsbulk_ingest_batch()withIngestMode::Appendinstead of building batched SQL INSERT stringsauto_create_tablesflag,created_tablestracking,new_without_table_creation()constructor,insert_sql_for_rows(),create_table_sql(),sql_type_for_arrow(),DEFAULT_INSERT_ROWS_PER_STATEMENTcreate_tableRPC, so the sink always usesIngestMode::Appendsrc/main.rsAdbcSink::new_without_table_creation()→AdbcSink::new()(single constructor now)