Repository navigation
[rust] Stream adapter for bounded readers (DataFusion interop) - #5061
Closed
VidyavathiGK wants to merge 1 commit into
Closed
VidyavathiGK wants to merge 1 commit into
VidyavathiGK wants to merge 1 commit into
Conversation
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.
Purpose
Linked issue: close apache/fluss-rust#572
Per maintainer guidance (see apache/fluss-rust#666), moving the bounded reader stream adapter and bare-
RecordBatchbridges intofluss-rustin the consolidatedapache/flussrepository.Provides a bare Arrow
RecordBatchbridge for DataFusion and PyArrow (RecordBatchStreamandto_record_batch_reader), givesLimitBatchScannerparity withRecordBatchLogReader(schema(&self)andSyncRecordBatchLimitScanner), and providesinto_record_batch_stream()across both bounded readers for seamless interop with DataFusion (RecordBatchStreamAdapter) and PyArrow.Brief change log
fluss-rust/crates/fluss/src/client/table/stream.rs):RecordBatchStream: AsynchronousStream<Item = Result<RecordBatch, ArrowError>>yielding bare Arrow batches (stripping Fluss metadata), with.schema() -> SchemaRefand.to_record_batch_reader(handle). Directly plugs into DataFusion'sRecordBatchStreamAdapteror PyArrow async workflows.ScanBatchStream: Named asynchronousStream<Item = Result<ScanBatch>>wrapper with.schema()and.into_record_batch_stream().SyncRecordBatchStreamReader: Synchronousarrow::record_batch::RecordBatchReaderadapter driven by a Tokio runtime handle.RecordBatchLogReader(fluss-rust/crates/fluss/src/client/table/reader.rs):into_record_batch_stream(self) -> RecordBatchStream.into_stream(),next_batch(),collect_all_batches(),schema(), andto_record_batch_reader(handle) -> SyncRecordBatchLogReader.LimitBatchScanner(fluss-rust/crates/fluss/src/client/table/batch_scanner.rs):schema: SchemaReffield andschema(&self) -> SchemaRefgetter (computed with projection pushdown awareness).into_record_batch_stream(self) -> RecordBatchStream.to_record_batch_reader(self, handle) -> SyncRecordBatchLimitScanner.SyncRecordBatchLimitScannerimplementingarrow::record_batch::RecordBatchReader(matchingSyncRecordBatchLogReaderparity).into_stream(),next_batch(),collect_all_batches(), andbucket().fluss-rust/crates/fluss/src/client/table/mod.rs):ScanBatchStream,RecordBatchStream,SyncRecordBatchStreamReader, andSyncRecordBatchLimitScanner.Tests
stream.rs:test_scan_batch_stream_consumption: verifying item polling, schema accessor, and stream termination.test_into_record_batch_stream: verifying conversion to bareRecordBatches and schema preservation.test_record_batch_stream_error_propagation: verifying error mapping toArrowError::ExternalError.test_sync_record_batch_stream_reader: verifying synchronousRecordBatchReaderiteration contract.tests/integration/batch_scanner.rs:batch_scanner_bare_record_batch_bridges: verifyinginto_record_batch_streamandto_record_batch_readeragainst real table data in a live cluster.tests/integration/record_batch_log_reader.rs:record_batch_log_reader_bare_record_batch_bridges: verifyinginto_record_batch_stream()andto_record_batch_reader()against a live cluster.API and Format
LimitBatchScanner:schema(),into_record_batch_stream(),to_record_batch_reader().RecordBatchLogReader:into_record_batch_stream().ScanBatchStream,RecordBatchStream,SyncRecordBatchStreamReader,SyncRecordBatchLimitScanner.Documentation