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

[SPARK-39867][SQL][3.1] Global limit should not inherit OrderPreservingUnaryNode #37398

Closed
wants to merge 1 commit into from

Conversation

ulysses-you
Copy link
Contributor

backport branch-3.1 for #37284

What changes were proposed in this pull request?

Make GlobalLimit inherit UnaryNode rather than OrderPreservingUnaryNode

Why are the changes needed?

Global limit can not promise the output ordering is same with child, it actually depend on the certain physical plan.

For all physical plan with gobal limits:

  • CollectLimitExec: it does not promise output ordering
  • GlobalLimitExec: it required all tuples so it can assume the child is shuffle or child is single partition. Then it can use output ordering of child
  • TakeOrderedAndProjectExec: it do sort inside it's implementation

This bug get worse since we pull out v1 write require ordering.

Does this PR introduce any user-facing change?

yes, bug fix

How was this patch tested?

fix test and add test

@github-actions github-actions bot added the SQL label Aug 3, 2022
Copy link
Member

@dongjoon-hyun dongjoon-hyun left a comment

Choose a reason for hiding this comment

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

Please fix the compilation error.

…ryNode

Make GlobalLimit inherit UnaryNode rather than OrderPreservingUnaryNode

Global limit can not promise the output ordering is same with child, it actually depend on the certain physical plan.

For all physical plan with gobal limits:
- CollectLimitExec: it does not promise output ordering
- GlobalLimitExec: it required all tuples so it can assume the child is shuffle or child is single partition. Then it can use output ordering of child
- TakeOrderedAndProjectExec: it do sort inside it's implementation

This bug get worse since we pull out v1 write require ordering.

yes, bug fix

fix test and add test

Closes apache#37284 from ulysses-you/sort.

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@ulysses-you
Copy link
Contributor Author

@dongjoon-hyun rebased

@ulysses-you
Copy link
Contributor Author

cc @viirya @cloud-fan

@cloud-fan
Copy link
Contributor

The python syle check failure is unrelated. Thanks, merging to 3.1!

cloud-fan pushed a commit that referenced this pull request Aug 5, 2022
…ngUnaryNode

backport branch-3.1 for #37284

### What changes were proposed in this pull request?

Make GlobalLimit inherit UnaryNode rather than OrderPreservingUnaryNode

### Why are the changes needed?

Global limit can not promise the output ordering is same with child, it actually depend on the certain physical plan.

For all physical plan with gobal limits:
- CollectLimitExec: it does not promise output ordering
- GlobalLimitExec: it required all tuples so it can assume the child is shuffle or child is single partition. Then it can use output ordering of child
- TakeOrderedAndProjectExec: it do sort inside it's implementation

This bug get worse since we pull out v1 write require ordering.

### Does this PR introduce _any_ user-facing change?

yes, bug fix

### How was this patch tested?

fix test and add test

Closes #37398 from ulysses-you/SPARK-39867-3.1.

Authored-by: ulysses-you <ulyssesyou18@gmail.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
@cloud-fan cloud-fan closed this Aug 5, 2022
@ulysses-you ulysses-you deleted the SPARK-39867-3.1 branch August 5, 2022 10:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants