You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/06/14 08:05:53 UTC
[GitHub] [spark] sarutak opened a new pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
sarutak opened a new pull request #32892:
URL: https://github.com/apache/spark/pull/32892
### What changes were proposed in this pull request?
<!--
Please clarify what changes you are proposing. The purpose of this section is to outline the changes and how this PR fixes the issue.
If possible, please consider writing useful notes for better and faster reviews in your PR. See the examples below.
1. If you refactor some codes with changing classes, showing the class hierarchy will help reviewers.
2. If you fix some SQL features, you can provide some references of other DBMSes.
3. If there is design documentation, please add the link.
4. If there is a discussion in the mailing list, please add the link.
-->
This PR add a feature which parse day-time interval literals to tightest type.
### Why are the changes needed?
<!--
Please clarify why the changes are needed. For instance,
1. If you propose a new API, clarify the use case for a new API.
2. If you fix a bug, you can clarify why it is a bug.
-->
To comply with the ANSI behavior.
For example, `INTERVAL '10 20:30' DAY TO MINUTE` should be parsed as `DayTimeIntervalType(DAY, MINUTE)` but not as `DayTimeIntervalType(DAY, SECOND)`.
### Does this PR introduce _any_ user-facing change?
<!--
Note that it means *any* user-facing change including all aspects such as the documentation fix.
If yes, please clarify the previous behavior and the change this PR proposes - provide the console output, description and/or an example to show the behavior difference if possible.
If possible, please also clarify if this is a user-facing change compared to the released Spark versions or within the unreleased branches such as master.
If no, write 'No'.
-->
No because `DayTimeIntervalType` will be introduced in `3.2.0`.
### How was this patch tested?
<!--
If tests were added, say they were added here. Please make sure to add some test cases that check the changes thoroughly including negative and positive cases if possible.
If it was tested in a way different from regular unit tests, please clarify how you tested step by step, ideally copy and paste-able, so that other reviewers can test and check, and descendants can verify in the future.
If tests were not added, please describe why they were not added and/or why it was difficult to add.
-->
New tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] sarutak commented on a change in pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
sarutak commented on a change in pull request #32892:
URL: https://github.com/apache/spark/pull/32892#discussion_r650572710
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -2357,9 +2357,14 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with SQLConfHelper with Logg
Literal(calendarInterval.months, YearMonthIntervalType)
} else {
assert(calendarInterval.months == 0)
+ val strToFieldIndex = DayTimeIntervalType.dayTimeFields.map(i =>
Review comment:
Yeah, it seems a common logic. After this and #32893 are merged, I'll open a followup PR.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk closed pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
MaxGekk closed pull request #32892:
URL: https://github.com/apache/spark/pull/32892
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] sarutak commented on pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
sarutak commented on pull request #32892:
URL: https://github.com/apache/spark/pull/32892#issuecomment-860265038
> Please, open a sub-task in JIRA to don't forget about it if it is hard to do in this PR.
Yes, I've noticed that we should support single field but single field is currently parsed as `CalendarIntervalType` so we need change the behavior. So I separated that from this issue.
Sure, I'll open a sub task.
BTW, what do you think of multiple fields like `1 day 2 hours`? They should be parsed as `DayTimeIntervalType` rather than `CalendarType`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins removed a comment on pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #32892:
URL: https://github.com/apache/spark/pull/32892#issuecomment-860095547
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] HyukjinKwon commented on pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #32892:
URL: https://github.com/apache/spark/pull/32892#issuecomment-860131758
cc @MaxGekk @yaooqinn FYI
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA commented on pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #32892:
URL: https://github.com/apache/spark/pull/32892#issuecomment-860087912
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk commented on pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
MaxGekk commented on pull request #32892:
URL: https://github.com/apache/spark/pull/32892#issuecomment-860261600
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] SparkQA removed a comment on pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #32892:
URL: https://github.com/apache/spark/pull/32892#issuecomment-860087912
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] AmplabJenkins commented on pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #32892:
URL: https://github.com/apache/spark/pull/32892#issuecomment-860095547
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org
[GitHub] [spark] MaxGekk commented on a change in pull request #32892: [SPARK-35737][SQL] Parse day-time interval literals to tightest types
Posted by GitBox <gi...@apache.org>.
MaxGekk commented on a change in pull request #32892:
URL: https://github.com/apache/spark/pull/32892#discussion_r650570068
##########
File path: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/parser/AstBuilder.scala
##########
@@ -2357,9 +2357,14 @@ class AstBuilder extends SqlBaseBaseVisitor[AnyRef] with SQLConfHelper with Logg
Literal(calendarInterval.months, YearMonthIntervalType)
} else {
assert(calendarInterval.months == 0)
+ val strToFieldIndex = DayTimeIntervalType.dayTimeFields.map(i =>
Review comment:
I have seen this already in other PR. Does it make sense to put it to a common place `case object DayTimeIntervalType`?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org