-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-25691][SQL] Use semantic equality in AliasViewChild in order to compare attributes #22713
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
Changes from 2 commits
87fc62a
64aafc5
c4aaa8d
0d334e3
0e49e91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -124,4 +124,11 @@ class RemoveRedundantAliasAndProjectSuite extends PlanTest with PredicateHelper | |
| val expected = Subquery(relation.select('a as "a", 'b).where('b < 10).select('a).analyze) | ||
| comparePlans(optimized, expected) | ||
| } | ||
|
|
||
| test("SPARK-25691: RemoveRedundantProject works also with different cases") { | ||
| val relation = LocalRelation('a.int, 'b.int) | ||
| val query = relation.select('A, 'b).analyzeCaseInsensitive | ||
| val optimized = Optimize.execute(query) | ||
| comparePlans(optimized, relation) | ||
|
||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it possible to come out a test case showing previous comparing is problematic?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 for adding a test case. BTW does it impact end-users? If it does we need to backport it to 2.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not sure if we can test this in a way different from running @maryannxue's checks. I'll try to find one in the next days. As of now, I have no evidence that this impacts end-users. If I'll find out a case, I'll notify you. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I added the check and I found a case which may be considered as a bug (not sure honestly, it is a weird situation which I think might occur, but it a bad condition, which we may want to handle differently).
Currently the rule doesn't work well when the output of the view and the output of its child differs because of some nullable. You can find an example in the UT I added, where the view has all the output attributes as nullable, while the child has one as not-nullable. In this case, we are currently failing with an exception in the optimizer rule
EliminateView. After the change, the plan is correctly created.