Conversation
Adds --stream flag for element-by-element processing of JSON arrays, JSONL, and CSV input. In streaming mode, each element is parsed, optionally transformed via mappings, and written to the output format immediately rather than buffering the entire dataset in memory. Supported streaming pipelines: - JSONL → JSONL/JSON/CSV (true line-by-line streaming) - CSV → JSONL/JSON/CSV (true row-by-row streaming) - JSON array → JSONL/JSON/CSV (parse + stream output) Features: - StreamWriter abstraction for incremental output - Mapping support (per-element transforms via -e/-m) - CSV delimiter support in streaming mode - Graceful fallback: --stream is silently ignored for unsupported format combinations (e.g. YAML→JSON) - Periodic flushing via BufWriter Includes 24 unit tests and 7 integration tests covering all streaming combinations, edge cases, and mapping integration. Fixes #29
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.
Adds a
--streamCLI flag for element-by-element processing of large files, enabling morph to handle datasets that would otherwise require loading everything into memory.New CLI Option
--streamSupported Streaming Pipelines
For unsupported combinations (e.g., YAML→JSON with
--stream), the flag is silently ignored and the normal pipeline runs.Implementation
src/streaming.rsmodule with:StreamWriter— incremental output writer for JSONL, JSON arrays, and CSVstream_jsonl()— line-by-line JSONL processingstream_csv()— row-by-row CSV processingstream_json_array()— JSON array streaming outputrun_streaming()— full pipeline orchestrator-e/-mflags--csv-delimiterin streaming mode)BufWriterfor performanceTests
src/streaming.rs: JSONL/CSV/JSON streaming, mappings, edge cases, tab delimiterstests/cross_format.rs: CLI--streamflag with various format combinationsFixes #29