feat(write): add DataFrame.writeParquet with ParquetWriteOptions#27
Merged
Conversation
This was referenced May 13, 2026
This was referenced May 15, 2026
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.
Which issue does this PR close?
Rationale for this change
DataFusion's
DataFrame::write_parquetis the natural sink for transformed data, but today the Java bindings have no way to write results back to Parquet —collect()into JVM-side Arrow batches is the only option. This blocks ETL-shaped workloads where read → transform → write needs to stay in native code.What changes are included in this PR?
org.apache.datafusion.ParquetWriteOptions(fluent setters forcompressionandsingleFileOutput), shaped to mirror the existingParquetReadOptions.DataFrame.writeParquet(String)andDataFrame.writeParquet(String, ParquetWriteOptions)overloads. Both retain the DataFrame (clone on the Rust side), matching the existingcount()/show()pattern; the receiver stays usable and must still be closed.Java_org_apache_datafusion_DataFrame_writeParquetWithOptionsinnative/src/lib.rs. Compression strings (e.g."zstd(3)","snappy","uncompressed") are passed verbatim to DataFusion; invalid values surface asRuntimeExceptionat write time.Deliberately not included this round:
overwriteModeknob / JavaInsertOpenum — DataFusion 53.1.0'swrite_parquetonly implementsAppend(OverwriteandReplaceraise"not implemented"). Re-adding the knob once upstream support lands is a non-breaking addition.partition_by,sort_by, row-group / page-size / dictionary / statistics / bloom-filter knobs — out of scope for the first cut.WriteOptionsbase.Are these changes tested?
Yes. Two test files added:
ParquetWriteOptionsTest— pure-Java unit tests for defaults and fluent setter behavior.DataFrameWriteParquetTest— four integration tests guarded byAssumptions.assumeTrue(Files.exists(lineitem))so they skip cleanly whentpch-data/is absent:singleFileOutput(true)produces a regular file at the supplied path.compression("zstd(3)")writes and reads back with row count preserved.writeParquet(pins the retain semantics).make testshows 42 tests, 0 failures.cargo clippy --all-targets --workspace -- -D warningsis clean.Are there any user-facing changes?
Yes — adds new public API (
DataFrame.writeParquetoverloads +ParquetWriteOptions). No removals or breaking changes.