Experimental: support parquet partition write#4670
Draft
kazantsev-maksim wants to merge 67 commits into
Draft
Conversation
This reverts commit 768b3e9.
# Conflicts: # native/Cargo.lock # native/core/Cargo.toml
# Conflicts: # native/core/Cargo.toml
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?
Part of: #1625, #4547
Rationale for this change
The native Parquet writer previously only supported local filesystem and HDFS output, and explicitly bailed out (Unsupported) on any query with partition columns. This meant that the very common INSERT ... PARTITIONED BY (...) pattern and any S3-backed table fell back to Spark's row-based writer.
What changes are included in this PR?
Native (Rust): New
partition_writer.rswithPartitionedWriter, which:splits each
RecordBatchby partition key and routes rows to a per-partition writer keyed by sub-directory (e.g. a=1/b=2); Escapes partition values to exactly mirror Spark/Hive ExternalCatalogUtils.escapePathName (control chars + a fixed special-char set percent-encoded as upper-case %XX);maps null/empty partition values to HIVE_DEFAULT_PARTITION (Spark's DEFAULT_PARTITION_NAME);
lazily creates writers on first use and closes all open writers concurrently, returning the real part-file paths.
parquet_writer.rs: refactored into a ParquetWriter trait with a StorageWriterFactory that selects the backend by URL scheme — local FS, HDFS (OpendalWriter), and now S3A (OpendalWriter behind s3-opendal). S3 credentials/endpoint/region are read from fs.s3a.* object-store options.
Proto: new repeated string partition_columns = 9 on the
ParquetWritermessage; planner wires partition_columns through to the native writer.Spark (Scala):
CometDataWritingCommand: supported output filesystems extended tofile,hdfs,s3a; partitioned writes are no longer rejected (only static partitions remain unsupported); partition column names are serialized into the proto.How are these changes tested?
Testing in progress