Repository navigation
Conversation
added 5 commits
November 22, 2026 08:57
Add lancedb_record_batch_reader_from_arrow_stream() to move a validated ArrowArrayStream into a LanceDBRecordBatchReader. The imported reader acquires the schema once, pulls batches lazily, and preserves producer schema and read errors, including a NULL get_last_error result. The public header now declares the standard Arrow C Data and Stream structures behind the shared inclusion guards. Import tests cover real Arrow C++ multi-batch producers through create, add and merge, plus callback validation, release ownership, schema failures, read failures and zero-row batches under valgrind. Refs #129
Declare the Arrow C ABI structs as canonical named structs and keep the C typedef aliases behind Doxygen conditionals. This preserves the public C ABI and both Arrow header inclusion orders while leaving Breathe with a single struct declaration for each type. Teach the ABI checker to resolve a typedef that refers to an earlier struct tag and to keep complete struct definitions out of the opaque-type list. Refs #129
A RecordBatch cannot represent null rows in the top-level struct, and the previous child-column extraction silently dropped the root validity bitmap. Check the parsed root null count first and return an Arrow error before building the batch. The imported ArrowArray is still released by RAII. Document the accepted shape, child nullability and independent stream, schema and array ownership. Add a valid root-null Arrow fixture that checks the destination table and stream release stay unchanged. Refs #129
Xuanwo
added a commit
that referenced
this pull request
Nov 22, 2026
Add lancedb_record_batch_reader_from_arrow_stream() for the write side of #129. It moves a validated ArrowArrayStream into a LanceDBRecordBatchReader, acquires the schema once, pulls batches lazily, and preserves producer schema and read errors, including a NULL get_last_error result. Validate required callbacks before taking ownership, clear the source release pointer, and release the producer exactly once after the move, including schema failure. Reject top-level struct null rows before extracting child columns, because a RecordBatch cannot represent them. Document the accepted RecordBatch shape and independent stream, schema and array ownership. Declare the standard Arrow C Data and Stream structures behind the shared inclusion guards, keep Doxygen from emitting duplicate typedef structs, and teach the ABI checker to resolve separate struct/typedef declarations. Add real C++ multi-batch create/add/merge coverage plus focused ownership, error and root-null fixtures. This replacement is based on actual main 55cd8a6 and retains the original #144 tests, headers, ABI checker and Delta/DML integration. Refs #144 Refs #129
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.
Superseded by #147, which preserves the importer and corrects the root-null test bitmap and commit authorship.
Summary
lancedb_record_batch_reader_from_arrow_stream()for the write side of query: support Arrow C Data Stream (ArrowArrayStream) for streaming reads and writes #129. It moves a validatedArrowArrayStreaminto an existingLanceDBRecordBatchReader, socreate,addandmerge_insertcan consume a C producer without the binding collecting batches first.get_schema/get_next/releasecallbacks before taking ownership. On a pre-move failure the caller still owns the stream. After the move, the binding releases the producer exactly once, including when schema acquisition fails, and leaves the caller's outer struct storage with its release pointer cleared.get_last_errorcallback returns NULL, fall back to the callback error code instead of panicking.include/lancedb.hunder the sharedARROW_C_DATA_INTERFACE/ARROW_C_STREAM_INTERFACEguards. Both include orders witharrow/c/abi.hcompile in C and C++.Arrow stream export is intentionally left for the runtime bridge work around #76. This change is additive and independent of the #122/#135 query changes.
Tests
ExportRecordBatchReaderproducer with multi-batch data through table create, add and merge, checking actual row values.get_last_error, and zero-row batches not being treated as EOF.Validation
cargo check --package lancedb-ccargo clippy --all-targets -- -D warningscargo fmt --checklancedb_arrow_stream_testsctest --test-dir build -R arrow_stream --output-on-failure(valgrind: 0 errors, 0 definitely/possibly lost)ninja -C build check-c17ninja -C build check-abi(host and x86_64-pc-windows-msvc)Refs #129