Repository navigation
[rust] Stream adapter for bounded readers (DataFusion interop) (#572) - #666
Closed
VidyavathiGK wants to merge 1 commit into
Closed
VidyavathiGK wants to merge 1 commit into
VidyavathiGK wants to merge 1 commit into
Conversation
Contributor
|
Hi @VidyavathiGK This repository is moved to fluss main repo, lives under fluss-rust module, so this repo is Archived and read-only now so Please open a PR to Fluss main repo https://github.com/apache/fluss |
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 #572
Provides
into_stream()on both bounded readers (LimitBatchScannerandRecordBatchLogReader) returning an asynchronousStream<Item = Result<ScanBatch>>(ScanBatchStream), along with a bare ArrowRecordBatchbridge for DataFusion and PyArrow (RecordBatchStreamandto_record_batch_reader). This gives the client a unified, consistent streaming and interop surface while keepingnext_batch()andcollect_all_batches()additive and intact.Brief change log
crates/fluss/src/client/table/stream.rs):ScanBatchStream: AsynchronousStream<Item = Result<ScanBatch>>wrapping bounded scanner/reader batches, with.schema() -> SchemaRef,.into_record_batch_stream(), and.to_record_batch_reader(handle).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.SyncRecordBatchStreamReader: Synchronousarrow::record_batch::RecordBatchReaderadapter driven by a Tokio runtime handle.RecordBatchLogReader(crates/fluss/src/client/table/reader.rs):into_stream(self) -> ScanBatchStream(fused unfold overnext_batch()).into_record_batch_stream(self) -> RecordBatchStream.next_batch(),collect_all_batches(),schema(), andto_record_batch_reader(handle) -> SyncRecordBatchLogReader.LimitBatchScanner(crates/fluss/src/client/table/batch_scanner.rs):schema: SchemaReffield andschema(&self) -> SchemaRefgetter (computed with projection pushdown awareness).into_stream(self) -> ScanBatchStream(fused unfold overnext_batch()).into_record_batch_stream(self) -> RecordBatchStream.to_record_batch_reader(self, handle) -> SyncRecordBatchLimitScanner.SyncRecordBatchLimitScannerimplementingarrow::record_batch::RecordBatchReader(matchingSyncRecordBatchLogReaderparity).next_batch(),collect_all_batches(), andbucket().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_into_stream: verifying stream consumption from a live cluster.batch_scanner_bare_record_batch_bridges: verifyinginto_record_batch_streamandto_record_batch_readeragainst real table data.tests/integration/record_batch_log_reader.rs:record_batch_log_reader_stream_and_bridges: verifyinginto_stream(),into_record_batch_stream(), andto_record_batch_reader()against a live cluster.API and Format
LimitBatchScanner:schema(),into_stream(),into_record_batch_stream(),to_record_batch_reader().RecordBatchLogReader:into_stream(),into_record_batch_stream().ScanBatchStream,RecordBatchStream,SyncRecordBatchStreamReader,SyncRecordBatchLimitScanner.Documentation