-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-43779][SQL] ParseToDate should load the EvalMode in main thread #41298
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
|
I needed to re-generate the golden files. |
| extends RuntimeReplaceable with ImplicitCastInputTypes with TimeZoneAwareExpression { | ||
|
|
||
| override lazy val replacement: Expression = format.map { f => | ||
| Cast(GetTimestamp(left, f, TimestampType, timeZoneId), DateType, timeZoneId) |
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.
can we pass evalMode to cast here as well?
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.
done
| emp 4 100.0 | ||
| emp 5 1000.0 | ||
| emp 6 - no dept 500.0 | ||
| java.lang.IllegalArgumentException |
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.
what happens here?
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.
Auto golden file regeneration gives this update
| override lazy val replacement: Expression = format.map { f => | ||
| Cast(GetTimestamp(left, f, TimestampType, timeZoneId), DateType, timeZoneId) | ||
| }.getOrElse(Cast(left, DateType, timeZoneId)) // backwards compatibility | ||
| Cast(GetTimestamp(left, f, TimestampType, timeZoneId, ansiEnabled), DateType, timeZoneId) |
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.
the Cast here still doesn't have the evalMod passed... But it's a good catch that we should pass ansiEnabled to GetTimestamp
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.
hmmm oops I see what is missing. Added.
|
thanks, merging to master! |
### What changes were proposed in this pull request? ParseToDate should load the EvalMode in main thread instead of loading it in a lazy val. ### Why are the changes needed? This is because it is sometimes hard to estimate when the lazy val is executed while the SQLConf where we load the EvalMode is thread local. ### Does this PR introduce _any_ user-facing change? No ### How was this patch tested? Existing UT Closes apache#41298 from amaliujia/SPARK-43779. Authored-by: Rui Wang <[email protected]> Signed-off-by: Wenchen Fan <[email protected]>
What changes were proposed in this pull request?
ParseToDate should load the EvalMode in main thread instead of loading it in a lazy val.
Why are the changes needed?
This is because it is sometimes hard to estimate when the lazy val is executed while the SQLConf where we load the EvalMode is thread local.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Existing UT