[SPARK-35112][SQL] Support Cast string to day-second interval#32271
[SPARK-35112][SQL] Support Cast string to day-second interval#32271AngersZhuuuu wants to merge 15 commits intoapache:masterfrom
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.
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.
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.
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.
@AngersZhuuuu Your force push reverted the changes I approved. Please, revert them back.
There was a problem hiding this comment.
@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 <max.gekk@gmail.com>
MaxGekk
left a comment
There was a problem hiding this comment.
LGTM, waiting for test results.
|
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.
+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.
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