| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
Closes apache#38 Mirrors writeParquet's surface for CSV: writeCsv(path) and writeCsv(path, options). Options class exposes singleFileOutput, partitionCols, hasHeader, delimiter, quote, escape, nullValue, and fileCompressionType. Uses the proto-over-JNI pattern (CsvWriteOptionsProto) rather than writeParquet's wide-JNI signature because the writer-side option set is much wider; a single byte[] keeps the JNI signature stable as more fields are added later. FileCompressionType is reused from csv_read_options.proto since the codec set is identical between read and write. Option<CsvOptions> on the Rust side stays None when no writer-side knob is set, so DataFusion's runtime defaults are preserved. Tests: 4 new options round-trip tests plus 7 integration tests (default round-trip, single-file, custom delimiter, gzip round-trip, retain-after-write, null path/options rejection). make test passes; cargo clippy/fmt and spotless are clean.
There was a problem hiding this comment.
LGTM. Thanks @LantaoJin
Sorry, something went wrong.
…e-csv # Conflicts: # native/build.rs
done |
Sorry, something went wrong.
Signed-off-by: Lantao Jin <jinlantao@gmail.com>
| Back | FazBrowse Home | New Git URL |
Which issue does this PR close?
Rationale for this change
DataFrame.writeParquet (#27) lets Java callers materialize a query result, but CSV remains read-only. DataFusion supports DataFrame::write_csv upstream with the full writer-side option surface (delimiter, quote, escape, null token, compression, partitioning, single-file vs directory output). Issue #38 tracks exposing it on the Java side.
The CSV write surface is wider than parquet's — six writer-side knobs plus singleFileOutput and partitionCols — so this PR uses the proto-over-JNI pattern (introduced in #29 and reused by all the read-side option classes) instead of the wide-JNI pattern writeParquet shipped with. Sending a single byte[] keeps the JNI signature stable as more knobs are added.
What changes are included in this PR?
Out of scope (for follow-ups):
Are these changes tested?
Yes, 11 new tests across CsvWriteOptionsTest and DataFrameWriteCsvTest.
Are there any user-facing changes?
Yes, purely additive. New public API:
The new org.apache.datafusion.protobuf.CsvWriteOptionsProto generated class is also exposed via the protobuf-Java output, consistent with how the read-side option protos are exposed. No API removals, no deprecations, no behavior change for existing callers.