-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-35112][SQL] Support Cast string to day-second interval #32271
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
|
FYI @MaxGekk |
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
Outdated
Show resolved
Hide resolved
MaxGekk
left a comment
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.
Take into account days in safeFromDayTimeString()
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #137728 has finished for PR 32271 at commit
|
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #138046 has finished for PR 32271 at commit
|
|
@MaxGekk I meet a case IntervalUtils.fromDayTimeString("2:03:04") throw exception It's a But right? since |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Kubernetes integration test unable to build dist. exiting with code: 1 |
|
Test build #138078 has finished for PR 32271 at commit
|
|
Test build #138080 has finished for PR 32271 at commit
|
|
Current test |
|
Test build #138105 has finished for PR 32271 at commit
|
|
@AngersZhuuuu Is it still WIP? Please, ping me when it is ready. |
|
@MaxGekk Can be reviewed now, but currently this method does not seem to be very efficient,Maybe should I add a new method to calculate calculate total microseconds separately? |
|
@MaxGekk I think it's ready for review now, but I am confused how can I use When I write It can't match, do you know how to match this? If it can be done, we can simplify more code. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #138123 has finished for PR 32271 at commit
|
|
Kubernetes integration test unable to build dist. exiting with code: 1 |
|
Test build #138127 has finished for PR 32271 at commit
|
MaxGekk
left a comment
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.
LGTM in general except a few comments.
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/Cast.scala
Outdated
Show resolved
Hide resolved
|
|
||
| test("SPARK-35112: Cast string to day-time interval") { | ||
| checkEvaluation(cast(Literal.create("0 0:0:0"), DayTimeIntervalType), 0L) | ||
| checkEvaluation(cast(Literal.create("INTERVAL '0 0:0:0' DAY TO SECOND"), |
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.
Could you check INTERVAL in lower case + spaces:
| checkEvaluation(cast(Literal.create("INTERVAL '0 0:0:0' DAY TO SECOND"), | |
| checkEvaluation(cast(Literal.create(" interval '0 0:0:0' Day TO second "), |
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.
@AngersZhuuuu Your force push reverted the changes I approved. Please, revert them back.
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.
@AngersZhuuuu Your force push reverted the changes I approved. Please, revert them back.
Updated
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
Outdated
Show resolved
Hide resolved
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/util/IntervalUtils.scala
Outdated
Show resolved
Hide resolved
…essions/Cast.scala Co-authored-by: Maxim Gekk <[email protected]>
MaxGekk
left a comment
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.
LGTM, waiting for test results.
MaxGekk
left a comment
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.
Please, address comments.
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
|
Test build #138132 has finished for PR 32271 at commit
|
Sorry for my late, since yesterday's run failed so I revert and recheck, but some thing urgent break my work. |
|
Kubernetes integration test starting |
|
Kubernetes integration test status failure |
MaxGekk
left a comment
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, LGTM. Merging to master.
Thank you, @AngersZhuuuu .
|
Test build #138139 has finished for PR 32271 at commit
|
|
|
||
| private val unquotedDaySecondPattern = | ||
| "([+|-])?(\\d+) (\\d{1,2}):(\\d{1,2}):(\\d{1,2})(\\.\\d{1,9})?" | ||
| private val quotedDaySecondPattern = (s"^$unquotedDaySecondPattern$$").r |
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.
unquotedDaySecondRegex?
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.
unquotedDaySecondRegex?
Change this in #32444
What changes were proposed in this pull request?
Support Cast string to day-seconds interval
Why are the changes needed?
Users can cast day-second interval string to DayTimeIntervalType.
Does this PR introduce any user-facing change?
No
How was this patch tested?
Added UT