Skip to content

feat: complete range repartition physical planning#23617

Open
saadtajwar wants to merge 6 commits into
apache:mainfrom
saadtajwar:saadtajwar/finish-range-repartition-physical-plan
Open

feat: complete range repartition physical planning#23617
saadtajwar wants to merge 6 commits into
apache:mainfrom
saadtajwar:saadtajwar/finish-range-repartition-physical-plan

Conversation

@saadtajwar

Copy link
Copy Markdown
Contributor

Which issue does this PR close?

Rationale for this change

After #23231 was merged in for supporting physical execution of the range repartitioning scheme, we still had a few methods on physical planning unimplemented, specifically try_swapping_with_projection, try_pushdown_sort, repartitioned - this PR finishes the implementation of those methods

What changes are included in this PR?

  • try_swapping_with_projection: similar to the Hash scheme, for Range we call update_expr for each of the range key expressions to attempt rewriting based on the projection expressions
  • try_pushdown_sort: same as other variants, we delegate to the child and wrap with a new RepartitionExec
  • repartitioned: unable to support for Range, left comment in codebase with explanation

Are these changes tested?

Yes

Are there any user-facing changes?

No

@github-actions github-actions Bot added the physical-plan Changes to the physical-plan crate label Jul 15, 2026
@saadtajwar saadtajwar marked this pull request as ready for review July 15, 2026 16:15
@saadtajwar

Copy link
Copy Markdown
Contributor Author

cc @gene-bordegaray & @gabotechs ! Thanks in advance for any feedback! 😁 🎉

@gene-bordegaray gene-bordegaray left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

left some feedback, thank you 🙇

);
};

Partitioning::Range(RangePartitioning::new(

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we use try_new

// https://github.com/apache/datafusion/issues/23230
return Ok(SortOrderPushdownResult::Unsupported);
}
Partitioning::RoundRobinBatch(_)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we remove this no-op match now since all are exhausted?

}

#[test]
fn range_repartition_swaps_with_projection_keeping_key() -> Result<()> {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I noticed no test for the sort pushdown, can we add one 👍

should have a sort maintaining range repartition then and assert and make sure result maintains the ordering


#[test]
fn range_repartition_swaps_with_projection_keeping_key() -> Result<()> {
let schema = Arc::new(Schema::new(vec![

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there is a lot of repeated boiler plate with schema set up and constructin. Can we extract / try to reuse some helpers to reduce this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

physical-plan Changes to the physical-plan crate

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Complete physical execution planning of range partitioning

2 participants