goutamadwant opened a new pull request, #24766: URL: https://github.com/apache/datafusion/pull/24766
## Which issue does this PR close? - Closes #24712. ## Rationale for this change Distributed and adaptive planners need to lower a range-partitioned plan's task count without discarding its higher-resolution boundary sample. Today scaling loses the range layout and falls back to unknown partitioning. ## What changes are included in this PR? - Add validated sample-backed construction, fallible scaling, and sample/current/max partition-count accessors while preserving existing exact construction and the borrowed `split_points()` API. - Cache deterministic effective split points and retain the shared maximum-resolution sample through projection, repartition, and join partitioning rewrites. - Preserve sample metadata through physical protobuf and FFI round trips. - Keep protobuf field 2 as the effective split points for older readers, while new readers validate the sample/count representation against it. ## Are these changes tested? Yes. Tests cover deterministic scaling and invalid counts, equality by effective boundaries, projection and plan rewrites, legacy/current/malformed protobuf payloads, and FFI unit and cross-library round trips. The full required workspace test suite and workspace-wide clippy with all targets and features passed. After refreshing the unchanged patch to current `main`, the focused `RangePartitioning` tests passed again. ## Are there any user-facing changes? Yes. `RangePartitioning` gains `try_new_with_samples`, `samples`, `max_partition_count`, and `scale`. Existing exact construction and `split_points()` callers remain source-compatible. `FFI_RangePartitioning` now carries samples and the current partition count, so this PR requires the `api change` label. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
