-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-31515][SQL] Canonicalize Cast should consider the value of needTimeZone #28288
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
Conversation
|
Test build #121605 has finished for PR 28288 at commit
|
4961eb3 to
1b50047
Compare
1b50047 to
95102cc
Compare
|
cc @hvanhovell |
| case a: AnsiCast if !a.needsTimeZone && a.timeZoneId.nonEmpty => | ||
| a.copy(timeZoneId = None) | ||
| case c: Cast if !c.needsTimeZone && c.timeZoneId.nonEmpty => | ||
| c.copy(timeZoneId = None) |
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.
case c: CastBase if c.timeZoneId.nonEmpty && !c.needsTimeZone =>
c.copy(timeZoneId = None)No need to call needsTimeZone twice.
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.
CastBase is not a case class and can't call copy
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.
hmm, ok:
case c: CastBase if c.timeZoneId.nonEmpty && !c.needsTimeZone => c.withTimeZone(null)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.
Thanks, done in 73f4694.
|
Test build #121614 has finished for PR 28288 at commit
|
|
Test build #121629 has finished for PR 28288 at commit
|
|
retest this please |
|
Test build #121641 has finished for PR 28288 at commit
|
…dTimeZone ### What changes were proposed in this pull request? Override the canonicalized fields with respect to the result of `needsTimeZone`. ### Why are the changes needed? The current approach breaks sematic equal of two cast expressions that don't relate with datetime type. If we don't need to use `timeZone` information casting `from` type to `to` type, then the timeZoneId should not influence the canonicalize result. ### Does this PR introduce any user-facing change? No. ### How was this patch tested? New UT added. Closes #28288 from xuanyuanking/SPARK-31515. Authored-by: Yuanjian Li <[email protected]> Signed-off-by: Takeshi Yamamuro <[email protected]> (cherry picked from commit ca90e19) Signed-off-by: Takeshi Yamamuro <[email protected]>
|
Thanks, all! Merged to master/3.0 |
|
Thanks for the review! |
What changes were proposed in this pull request?
Override the canonicalized fields with respect to the result of
needsTimeZone.Why are the changes needed?
The current approach breaks sematic equal of two cast expressions that don't relate with datetime type. If we don't need to use
timeZoneinformation castingfromtype tototype, then the timeZoneId should not influence the canonicalize result.Does this PR introduce any user-facing change?
No.
How was this patch tested?
New UT added.