[SPARK-43190][SQL] ListQuery.childOutput should be consistent with child output#40851
Closed
cloud-fan wants to merge 1 commit intoapache:masterfrom
Closed
[SPARK-43190][SQL] ListQuery.childOutput should be consistent with child output#40851cloud-fan wants to merge 1 commit intoapache:masterfrom
cloud-fan wants to merge 1 commit intoapache:masterfrom
Conversation
cloud-fan
commented
Apr 19, 2023
| val listQuery2 = ListQuery(testRelation2.select($"b")) | ||
| val plan = testRelation3.where($"f".in(listQuery1) && $"f".in(listQuery2)).analyze | ||
| val resolvedCondition = plan.expressions.head | ||
| val finalPlan = testRelation2.join(testRelation3).where(resolvedCondition).analyze |
Contributor
Author
There was a problem hiding this comment.
The test uses the resolved ListQuery to build a new plan and resolve it, to trigger the bug. Otherwise the bug is hidden because DeduplicateRelations runs before ResolveSubqueries, and the plan output of ListQuery won't be changed again.
Contributor
Author
|
cc @viirya |
viirya
approved these changes
Apr 20, 2023
Member
|
Looks good to me. |
Contributor
Author
|
thanks for the review, merging to master! |
LuciferYang
pushed a commit
to LuciferYang/spark
that referenced
this pull request
Apr 21, 2023
…ild output ### What changes were proposed in this pull request? Update `ListQuery` to only store the number of columns of the original plan, instead of directly storing the original plan output attributes. ### Why are the changes needed? Storing the plan output attributes is troublesome as we have to maintain them and keep them in sync with the plan. For example, `DeduplicateRelations` may change the plan output, and today we do not update `ListQuery.childOutputs` to keep sync. `ListQuery.childOutputs` was added by apache#18968 . It's only used to track the original plan output attributes as subquery de-correlation may add more columns. We can do the same thing by storing the number of columns of the plan. ### Does this PR introduce _any_ user-facing change? No, there is no user-facing bug exposed. ### How was this patch tested? a new plan test Closes apache#40851 from cloud-fan/list_query. Authored-by: Wenchen Fan <wenchen@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com>
|
@cloud-fan it seems that this patch resolved issue https://issues.apache.org/jira/browse/SPARK-41191?. In SPARK-41191, nested cache table does not work because of different attribute exprId @mcdull-zhang https://github.com/apache/spark/pull/38703/files#r1027906540 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
What changes were proposed in this pull request?
Update
ListQueryto only store the number of columns of the original plan, instead of directly storing the original plan output attributes.Why are the changes needed?
Storing the plan output attributes is troublesome as we have to maintain them and keep them in sync with the plan. For example,
DeduplicateRelationsmay change the plan output, and today we do not updateListQuery.childOutputsto keep sync.ListQuery.childOutputswas added by #18968 . It's only used to track the original plan output attributes as subquery de-correlation may add more columns. We can do the same thing by storing the number of columns of the plan.Does this PR introduce any user-facing change?
No, there is no user-facing bug exposed.
How was this patch tested?
a new plan test