Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve EnforceSorting docs. #14673

Merged
merged 7 commits into from
Feb 16, 2025

Conversation

wiedld
Copy link
Contributor

@wiedld wiedld commented Feb 14, 2025

Which issue does this PR close?

Rationale for this change

What changes are included in this PR?

Only docs. No code.

Are these changes tested?

N/A

Are there any user-facing changes?

N/A

@github-actions github-actions bot added physical-expr Physical Expressions optimizer Optimizer rules labels Feb 14, 2025
@wiedld wiedld changed the title Update EnforceSorting docs. Improve EnforceSorting docs. Feb 14, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @wiedld -- this looks great

cc @xudong963

datafusion/physical-optimizer/src/enforce_sorting/mod.rs Outdated Show resolved Hide resolved
datafusion/physical-optimizer/src/enforce_sorting/mod.rs Outdated Show resolved Hide resolved
datafusion/physical-optimizer/src/enforce_sorting/mod.rs Outdated Show resolved Hide resolved
datafusion/physical-optimizer/src/enforce_sorting/mod.rs Outdated Show resolved Hide resolved
datafusion/physical-optimizer/src/enforce_sorting/mod.rs Outdated Show resolved Hide resolved
datafusion/physical-optimizer/src/enforce_sorting/mod.rs Outdated Show resolved Hide resolved
/// A node context object beneficial for writing optimizer rules.
/// This context encapsulating an [`ExecutionPlan`] node with a payload.
///
/// Since each wrapped node has it's children within both the [`PlanContext.plan.children()`],
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

this is indeed quite subtle -- it would be awesome if we could find some way to make it harder to forget to call update_plan_from_children

@alamb alamb added the documentation Improvements or additions to documentation label Feb 14, 2025
@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Feb 15, 2025
@wiedld wiedld marked this pull request as ready for review February 15, 2025 05:37
/// whether we elect to transform [`CoalescePartitionsExec`] + [`SortExec`] cascades
/// into [`SortExec`] + [`SortPreservingMergeExec`] cascades, which enables us to
/// perform sorting in parallel.
/// Performs optimizations based upon a series of subrules.
Copy link
Contributor

Choose a reason for hiding this comment

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

👍

/// sort first on a per-partition basis, thereby parallelizing the sort.
///
///
/// The outcome is that plans of the form
Copy link
Contributor

Choose a reason for hiding this comment

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

nice

@alamb alamb added the documentation Improvements or additions to documentation label Feb 15, 2025
Copy link
Member

@xudong963 xudong963 left a comment

Choose a reason for hiding this comment

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

A great reading experience, thanks @wiedld

@github-actions github-actions bot removed the documentation Improvements or additions to documentation label Feb 16, 2025
@alamb alamb mentioned this pull request Feb 16, 2025
@alamb alamb added the documentation Improvements or additions to documentation label Feb 16, 2025
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thanks again @wiedld and @xudong963

fn update_sort_ctx_children_data(
mut node: PlanWithCorrespondingSort,
mut node_and_ctx: PlanWithCorrespondingSort,
Copy link
Contributor

Choose a reason for hiding this comment

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

💯

@alamb alamb merged commit 50c3547 into apache:main Feb 16, 2025
26 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation optimizer Optimizer rules physical-expr Physical Expressions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants