-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-28107][SQL] Support 'DAY TO (HOUR|MINUTE|SECOND)', 'HOUR TO (MINUTE|SECOND)' and 'MINUTE TO SECOND' #25000
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
Closed
Closed
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
8c99767
support day to hour and day to minute and hour to minute and minute t…
zhulipeng ed4b3cf
refine code
zhulipeng 3edfed6
length exceed
zhulipeng fa68a41
add test case for default branch
zhulipeng 2b5408d
remove duplicate codes and add method description
zhulipeng c41dccc
resolve conflicts with master
zhulipeng d68ea26
for consistent
zhulipeng 7fd926a
minimize
dongjoon-hyun bf78d73
Merge pull request #3 from dongjoon-hyun/PR-25000
zhulipeng ebe917c
typo
zhulipeng File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1183,12 +1183,31 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton { | |
| Row(CalendarInterval.fromString("interval 100 milliseconds"))) | ||
| checkAnswer(sql("select interval '10-9' year to month"), | ||
| Row(CalendarInterval.fromString("interval 10 years 9 months"))) | ||
| checkAnswer(sql("select interval '20 15:40:32.99899999' day to hour"), | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All these test cases are positive ones. Could you add the negative cases too? Do they throw an exception? Exception messages make sense? |
||
| Row(CalendarInterval.fromString("interval 2 weeks 6 days 15 hours"))) | ||
| checkAnswer(sql("select interval '20 15:40:32.99899999' day to minute"), | ||
| Row(CalendarInterval.fromString("interval 2 weeks 6 days 15 hours 40 minutes"))) | ||
| checkAnswer(sql("select interval '20 15:40:32.99899999' day to second"), | ||
| Row(CalendarInterval.fromString("interval 2 weeks 6 days 15 hours 40 minutes " + | ||
| "32 seconds 998 milliseconds 999 microseconds"))) | ||
| checkAnswer(sql("select interval '15:40:32.99899999' hour to minute"), | ||
| Row(CalendarInterval.fromString("interval 15 hours 40 minutes"))) | ||
| checkAnswer(sql("select interval '15:40.99899999' hour to second"), | ||
| Row(CalendarInterval.fromString("interval 15 minutes 40 seconds 998 milliseconds " + | ||
| "999 microseconds"))) | ||
| checkAnswer(sql("select interval '15:40' hour to second"), | ||
| Row(CalendarInterval.fromString("interval 15 hours 40 minutes"))) | ||
| checkAnswer(sql("select interval '15:40:32.99899999' hour to second"), | ||
| Row(CalendarInterval.fromString("interval 15 hours 40 minutes 32 seconds 998 milliseconds " + | ||
| "999 microseconds"))) | ||
| checkAnswer(sql("select interval '20 40:32.99899999' minute to second"), | ||
| Row(CalendarInterval.fromString("interval 2 weeks 6 days 40 minutes 32 seconds " + | ||
| "998 milliseconds 999 microseconds"))) | ||
| checkAnswer(sql("select interval '40:32.99899999' minute to second"), | ||
| Row(CalendarInterval.fromString("interval 40 minutes 32 seconds 998 milliseconds " + | ||
| "999 microseconds"))) | ||
| checkAnswer(sql("select interval '40:32' minute to second"), | ||
| Row(CalendarInterval.fromString("interval 40 minutes 32 seconds"))) | ||
| checkAnswer(sql("select interval '30' year"), | ||
| Row(CalendarInterval.fromString("interval 30 years"))) | ||
| checkAnswer(sql("select interval '25' month"), | ||
|
|
||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.