-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-29371][SQL] Fractional representation for interval string #26592
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 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
62560cf
[SPARK-29371][SQL] Frational representation for interval string
yaooqinn 7ee83f5
use double directly
yaooqinn 4018278
benchmark
yaooqinn dd40ea0
jdk11 benchmark
yaooqinn 4dc8f02
round for microseconds for each unit
yaooqinn 393ad77
Merge branch 'master' into SPARK-29371-2
yaooqinn a5e2811
regen golden file
yaooqinn 5b4f518
add negative value test
yaooqinn 854b6f8
fix tests
yaooqinn 5af9a93
Merge branch 'master' into SPARK-29371-2
yaooqinn 5604b83
add . check back
yaooqinn 1684d3a
Merge branch 'master' into SPARK-29371-2
yaooqinn 4dffac9
regen golden file
yaooqinn 1ccfbbf
Merge branch 'master' into SPARK-29371-2
yaooqinn fe3e6ba
regen golden file
yaooqinn 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
regen golden file
- Loading branch information
commit a5e2811b5f3c0f1d5d261731e688a9969620acef
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,5 @@ | ||
| -- Automatically generated by SQLQueryTestSuite | ||
| -- Number of queries: 130 | ||
| -- Number of queries: 140 | ||
|
|
||
|
|
||
| -- !query 0 | ||
|
|
@@ -479,9 +479,9 @@ struct<justifyInterval(INTERVAL '1 months 59 days -25 hours'):interval> | |
| -- !query 59 | ||
| select interval 13.123456789 seconds, interval -13.123456789 second | ||
| -- !query 59 schema | ||
| struct<INTERVAL '13.123456 seconds':interval,INTERVAL '-13.123456 seconds':interval> | ||
| struct<INTERVAL '13.123457 seconds':interval,INTERVAL '-13.123457 seconds':interval> | ||
| -- !query 59 output | ||
| 13.123456 seconds -13.123456 seconds | ||
| 13.123457 seconds -13.123457 seconds | ||
|
|
||
|
|
||
| -- !query 60 | ||
|
|
@@ -1116,34 +1116,114 @@ struct<(INTERVAL '99 days 11 hours 22 minutes 33.123456 seconds' + INTERVAL '10 | |
|
|
||
|
|
||
| -- !query 118 | ||
| select 1 year 2 days | ||
| select interval '1.41666666666666 year' | ||
| -- !query 118 schema | ||
| struct<INTERVAL '1 years 2 days':interval> | ||
| struct<INTERVAL '1 years 4 months':interval> | ||
| -- !query 118 output | ||
| 1 years 2 days | ||
| 1 years 4 months | ||
|
|
||
|
|
||
| -- !query 119 | ||
| select '10-9' year to month | ||
| select interval '1.41666666666667 year' | ||
| -- !query 119 schema | ||
| struct<INTERVAL '10 years 9 months':interval> | ||
| struct<INTERVAL '1 years 5 months':interval> | ||
| -- !query 119 output | ||
| 10 years 9 months | ||
| 1 years 5 months | ||
|
|
||
|
|
||
| -- !query 120 | ||
| select '20 15:40:32.99899999' day to second | ||
| select interval '1.1333333333301 months' | ||
| -- !query 120 schema | ||
| struct<INTERVAL '20 days 15 hours 40 minutes 32.998999 seconds':interval> | ||
| struct<INTERVAL '1 months 3 days 23 hours 59 minutes 59.999992 seconds':interval> | ||
| -- !query 120 output | ||
| 20 days 15 hours 40 minutes 32.998999 seconds | ||
| 1 months 3 days 23 hours 59 minutes 59.999992 seconds | ||
|
|
||
|
|
||
| -- !query 121 | ||
| select 30 day day | ||
| select interval '1.133333333330 months' | ||
| -- !query 121 schema | ||
| struct<> | ||
| struct<INTERVAL '1 months 3 days 23 hours 59 minutes 59.999991 seconds':interval> | ||
| -- !query 121 output | ||
| 1 months 3 days 23 hours 59 minutes 59.999991 seconds | ||
|
|
||
|
|
||
| -- !query 122 | ||
| select interval '2.13333333 week' | ||
| -- !query 122 schema | ||
| struct<INTERVAL '14 days 22 hours 23 minutes 59.997984 seconds':interval> | ||
| -- !query 122 output | ||
| 14 days 22 hours 23 minutes 59.997984 seconds | ||
|
|
||
|
|
||
| -- !query 123 | ||
| select interval '2.13333334 week' | ||
| -- !query 123 schema | ||
| struct<INTERVAL '14 days 22 hours 24 minutes 0.004032 seconds':interval> | ||
| -- !query 123 output | ||
| 14 days 22 hours 24 minutes 0.004032 seconds | ||
|
|
||
|
|
||
| -- !query 124 | ||
| select interval '0.1 seconds' | ||
| -- !query 124 schema | ||
| struct<INTERVAL '0.1 seconds':interval> | ||
| -- !query 124 output | ||
| 0.1 seconds | ||
|
|
||
|
|
||
| -- !query 125 | ||
| select interval '0.49 microseconds' | ||
| -- !query 125 schema | ||
| struct<INTERVAL '0 seconds':interval> | ||
| -- !query 125 output | ||
| 0 seconds | ||
|
|
||
|
|
||
| -- !query 126 | ||
| select interval '0.50 microseconds' | ||
|
||
| -- !query 126 schema | ||
| struct<INTERVAL '0.000001 seconds':interval> | ||
| -- !query 126 output | ||
| 0.000001 seconds | ||
|
|
||
|
|
||
| -- !query 127 | ||
| select interval '87649415 hours 59 minutes 59 seconds 999 milliseconds 999 microseconds' | ||
| -- !query 127 schema | ||
| struct<INTERVAL '87649415 hours 59 minutes 59.999999 seconds':interval> | ||
| -- !query 127 output | ||
| 87649415 hours 59 minutes 59.999999 seconds | ||
|
|
||
|
|
||
| -- !query 128 | ||
| select 1 year 2 days | ||
| -- !query 128 schema | ||
| struct<INTERVAL '1 years 2 days':interval> | ||
| -- !query 128 output | ||
| 1 years 2 days | ||
|
|
||
|
|
||
| -- !query 129 | ||
| select '10-9' year to month | ||
| -- !query 129 schema | ||
| struct<INTERVAL '10 years 9 months':interval> | ||
| -- !query 129 output | ||
| 10 years 9 months | ||
|
|
||
|
|
||
| -- !query 130 | ||
| select '20 15:40:32.99899999' day to second | ||
| -- !query 130 schema | ||
| struct<INTERVAL '20 days 15 hours 40 minutes 32.998999 seconds':interval> | ||
| -- !query 130 output | ||
| 20 days 15 hours 40 minutes 32.998999 seconds | ||
|
|
||
|
|
||
| -- !query 131 | ||
| select 30 day day | ||
| -- !query 131 schema | ||
| struct<> | ||
| -- !query 131 output | ||
| org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
||
| no viable alternative at input 'day'(line 1, pos 14) | ||
|
|
@@ -1153,27 +1233,27 @@ select 30 day day | |
| --------------^^^ | ||
|
|
||
|
|
||
| -- !query 122 | ||
| -- !query 132 | ||
| select date'2012-01-01' - '2-2' year to month | ||
| -- !query 122 schema | ||
| -- !query 132 schema | ||
| struct<CAST(CAST(DATE '2012-01-01' AS TIMESTAMP) - INTERVAL '2 years 2 months' AS DATE):date> | ||
| -- !query 122 output | ||
| -- !query 132 output | ||
| 2009-11-01 | ||
|
|
||
|
|
||
| -- !query 123 | ||
| -- !query 133 | ||
| select 1 month - 1 day | ||
| -- !query 123 schema | ||
| -- !query 133 schema | ||
| struct<INTERVAL '1 months -1 days':interval> | ||
| -- !query 123 output | ||
| -- !query 133 output | ||
| 1 months -1 days | ||
|
|
||
|
|
||
| -- !query 124 | ||
| -- !query 134 | ||
| select 1 year to month | ||
| -- !query 124 schema | ||
| -- !query 134 schema | ||
| struct<> | ||
| -- !query 124 output | ||
| -- !query 134 output | ||
| org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
||
| The value of from-to unit must be a string(line 1, pos 7) | ||
|
|
@@ -1183,11 +1263,11 @@ select 1 year to month | |
| -------^^^ | ||
|
|
||
|
|
||
| -- !query 125 | ||
| -- !query 135 | ||
| select '1' year to second | ||
| -- !query 125 schema | ||
| -- !query 135 schema | ||
| struct<> | ||
| -- !query 125 output | ||
| -- !query 135 output | ||
| org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
||
| Intervals FROM year TO second are not supported.(line 1, pos 7) | ||
|
|
@@ -1197,11 +1277,11 @@ select '1' year to second | |
| -------^^^ | ||
|
|
||
|
|
||
| -- !query 126 | ||
| -- !query 136 | ||
| select 1 year '2-1' year to month | ||
| -- !query 126 schema | ||
| -- !query 136 schema | ||
| struct<> | ||
| -- !query 126 output | ||
| -- !query 136 output | ||
| org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
||
| Can only have a single from-to unit in the interval literal syntax(line 1, pos 14) | ||
|
|
@@ -1211,11 +1291,11 @@ select 1 year '2-1' year to month | |
| --------------^^^ | ||
|
|
||
|
|
||
| -- !query 127 | ||
| -- !query 137 | ||
| select (-30) day | ||
| -- !query 127 schema | ||
| -- !query 137 schema | ||
| struct<> | ||
| -- !query 127 output | ||
| -- !query 137 output | ||
| org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
||
| no viable alternative at input 'day'(line 1, pos 13) | ||
|
|
@@ -1225,11 +1305,11 @@ select (-30) day | |
| -------------^^^ | ||
|
|
||
|
|
||
| -- !query 128 | ||
| -- !query 138 | ||
| select (a + 1) day | ||
| -- !query 128 schema | ||
| -- !query 138 schema | ||
| struct<> | ||
| -- !query 128 output | ||
| -- !query 138 output | ||
| org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
||
| no viable alternative at input 'day'(line 1, pos 15) | ||
|
|
@@ -1239,11 +1319,11 @@ select (a + 1) day | |
| ---------------^^^ | ||
|
|
||
|
|
||
| -- !query 129 | ||
| -- !query 139 | ||
| select 30 day day day | ||
| -- !query 129 schema | ||
| -- !query 139 schema | ||
| struct<> | ||
| -- !query 129 output | ||
| -- !query 139 output | ||
| org.apache.spark.sql.catalyst.parser.ParseException | ||
|
|
||
| no viable alternative at input 'day'(line 1, pos 14) | ||
|
|
||
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
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.
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.