[SPARK-35737][SQL] Parse day-time interval literals to tightest types#32892
[SPARK-35737][SQL] Parse day-time interval literals to tightest types#32892sarutak wants to merge 5 commits into
Conversation
|
Kubernetes integration test starting |
|
Test build #139742 has finished for PR 32892 at commit
|
|
Kubernetes integration test status success |
…aytime-interval
b4fdd39 to
32cce06
Compare
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Kubernetes integration test starting |
|
Kubernetes integration test status success |
|
Test build #139753 has finished for PR 32892 at commit
|
a41fd2b to
eef88fc
Compare
|
Kubernetes integration test starting |
|
@sarutak We should support single field as well there: Please, open a sub-task in JIRA to don't forget about it if it is hard to do in this PR. |
|
Kubernetes integration test status failure |
| Literal(calendarInterval.months, YearMonthIntervalType) | ||
| } else { | ||
| assert(calendarInterval.months == 0) | ||
| val strToFieldIndex = DayTimeIntervalType.dayTimeFields.map(i => |
There was a problem hiding this comment.
I have seen this already in other PR. Does it make sense to put it to a common place case object DayTimeIntervalType?
There was a problem hiding this comment.
Yeah, it seems a common logic. After this and #32893 are merged, I'll open a followup PR.
|
Test build #139754 has finished for PR 32892 at commit
|
Yes, I've noticed that we should support single field but single field is currently parsed as BTW, what do you think of multiple fields like |
I think we should take into account the SQL config |
|
+1, LGTM. Merging to master. |
…imeIntervalType ### What changes were proposed in this pull request? This is a followup PR for SPARK-35736(#32893) and SPARK-35737(#32892). This PR moves a common logic to `object DayTimeIntervalType`. That logic is like `val strToFieldIndex = DayTimeIntervalType.dayTimeFields.map(i => DayTimeIntervalType.fieldToString(i) -> (i).toMap`, a `Map` which maps each time unit to the corresponding day-time field index. ### Why are the changes needed? That logic appeared in the change in SPARK-35736 and SPARK-35737 so it can be a common logic and it's better to avoid the similar logic scattered. ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Existing tests. Closes #32905 from sarutak/followup-SPARK-35736-35737. Authored-by: Kousuke Saruta <sarutak@oss.nttdata.com> Signed-off-by: Max Gekk <max.gekk@gmail.com>
What changes were proposed in this pull request?
This PR add a feature which parse day-time interval literals to tightest type.
Why are the changes needed?
To comply with the ANSI behavior.
For example,
INTERVAL '10 20:30' DAY TO MINUTEshould be parsed asDayTimeIntervalType(DAY, MINUTE)but not asDayTimeIntervalType(DAY, SECOND).Does this PR introduce any user-facing change?
No because
DayTimeIntervalTypewill be introduced in3.2.0.How was this patch tested?
New tests.