fix: fetch is missed during EnforceDistribution - #14207
Closed
xudong963 wants to merge 7 commits into
Closed
Conversation
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.
Which issue does this PR close?
EnforceDistributiongenerates invalid plan #14150Rationale for this change
The root of the bug is that if there is a SortPreservingMergeExec operator and it has the fetch, the method(
remove_dist_changing_operators) will remove it directly, and miss the fetch. So it's definitely a bug.IIUC, SortPreservingMergeExec only will be added after
EnforceSorting, so if we want to reproduce the bug,EnforceDistributionneeds to run afterEnforceSorting, the default physical optimizer has the order of rules:EnforceDistribution->EnforceSorting, so it won't trigger the bug(fetch is missed), but if we runEnforceDistributionagain afterEnforceSorting, the bug will surface.What the PR is doing is that it will remain the fetch of
SortPreservingMergeExecand add it back if necessary, as the comments of the method said:If they are necessary, they will be added in subsequent stages.What changes are included in this PR?
Avoid missing fetch during
EnforceDistribution.Are these changes tested?
YES
Are there any user-facing changes?
NO