Repository navigation
[datafusion] Expose range partitioning for table partition keys - #1314
Merged
SteNicholas merged 4 commits intoNov 3, 2026
Merged
Conversation
SteNicholas
reviewed
Nov 3, 2026
Member
There was a problem hiding this comment.
@JingsongLi, I left some comments for extending regression coverage. PTAL.
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
Follow-up to #1236. Paimon scans report
UnknownPartitioningeven when table partition keys prove disjoint ranges, preventing DataFusion 55 from reusing that distribution for compatible aggregations and joins.Brief change log
Group whole splits using typed Arrow comparisons with
ASC NULLS LAST, keeping equal keys together and combining adjacent key groups withintarget_partitions. Support Boolean, integer, string, date, millisecond time, Decimal128, and composite partition keys.Native primary-key scans require every partition column to belong to the primary key. Non-key partition columns can be changed by current or historical value aggregation, so these layouts retain the original unknown distribution regardless of the current merge engine.
Use the shared scan construction path for regular, Variant, and audit-log scans, and expose range metadata in EXPLAIN. This declares distribution without claiming rows within each range are sorted.
Preserve original split assignments and
UnknownPartitioningfor unsupported types, unavailable partition keys, malformed metadata, authorization rules, and empty/single-partition/single-key scans.Stabilize the shared-cache batch lock regression by retaining duplicate descriptors and explicitly unlocking before non-blocking reacquisition, covering descriptor inheritance during concurrent process tests.
Tests
Added 5 unit tests and 12 integration tests covering boundaries, duplicate keys and NULLs across files, composite keys and projection, unsupported/authorization fallbacks, aggregation exchange elimination, Hash/Sort-Merge Join alignment after PK updates, Variant pushdown, and audit-log scans. Native PK regressions verify aggregation, partial-update sequence groups, and persisted aggregate values after a merge-engine change; full-PK partition columns retain range metadata and exchange elimination. Compatible-range Hash Join and Sort-Merge Join cases assert correct many-to-many results without exchanges. A format-table fixture with partition columns absent from its Parquet files verifies restored row membership and correct exchange-free GROUP BY results.
Passed:
cargo test --locked -p paimon --lib --features vortex io::cache::disk::shared::tests(24 tests)cargo test --locked -p paimon --lib --features vortex -- --test-threads=4(4823 passed, 6 ignored)RUST_MIN_STACK=16777216 cargo test --locked -p paimon-datafusion --test range_partitioningRUST_MIN_STACK=16777216 cargo test --locked -p paimon-datafusion --test format_table_partition_filters --test format_table_statisticscargo clippy --locked -p paimon-datafusion --test range_partitioning --no-deps -- -D warningscargo fmt --all -- --checkThe preceding
ec02b94frevision also passed the full DataFusion suite with the two baseline failures below excluded, and all GitHub CI jobs. This follow-up changes tests only.The unfiltered test run failed on
test_create_tag_from_timestampandtest_rollback_to_timestamp; both failures also reproduce in a clean worktree at the unchanged base5bb42a11. Full dependency linting encounters six existingclippy::nonminimal_booldiagnostics in the corepaimoncrate.API and Format
No public API or storage format changes. Eligible scans expose
Rangedistribution metadata; scan parallelism can be lower than the target when there are fewer distinct partition keys.Documentation
Updated
docs/src/sql.mdwith supported types, grouping behavior, ordering guarantees, and fallback conditions.