-
Notifications
You must be signed in to change notification settings - Fork 28.4k
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-25691][SQL] Use semantic equality in AliasViewChild in order to compare attributes #22713
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 commentThe reason will be displayed to describe this comment to others. Learn more. I agree that using For instance, I don't think this is a valid case. If we optimize it, the final schema field names will change, which is a breaking change if this plan is an input of a parquet writer. (the result parquet files will have a different schema) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks for you comment. Then let me focus for this only to the view topic, we can open other tickets for each change later.
I see the concern about the possible breaking change, so I agree about not introducing this. My point is: then we are saying that Spark is never really case-insensitive, even though the case sensitive option is turned to false, isn't it? Shouldn't datasources write/read columns in a non-case-sensitive way when this flag is turned on? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Spark can be case-sensitive or not w.r.t. the config, but Spark should always be case-preserving. |
||
} | ||
} |
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.