Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
regen golden file
  • Loading branch information
yaooqinn committed Nov 25, 2019
commit 4dffac9f8c84a346d2a8bf82d13f6a06ea92dc7d
3 changes: 1 addition & 2 deletions sql/core/src/test/resources/sql-tests/inputs/interval.sql
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ from interval_arithmetic;
-- control characters as white spaces
select interval '\t interval 1 day';


select interval '1.41666666666666 year';
select interval '1.41666666666667 year';
select interval '1.1333333333301 months';
Expand All @@ -273,4 +272,4 @@ select interval '0.49 microseconds';
select interval '0.50 microseconds';
select interval '87649415 hours 59 minutes 59 seconds 999 milliseconds 999 microseconds';
select interval '-0.51 year';
select interval '-0.41 year';
select interval '-0.41 year';
172 changes: 134 additions & 38 deletions sql/core/src/test/resources/sql-tests/results/ansi/interval.sql.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 131
-- Number of queries: 143


-- !query 0
Expand Down Expand Up @@ -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
Copy link
Member Author

@yaooqinn yaooqinn Nov 19, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

postgres=# select interval '13.123456789 seconds';
    interval
-----------------
 00:00:13.123457
(1 row)

postgres=# select interval '-13.123456789 seconds';
     interval
------------------
 -00:00:13.123457
(1 row)



-- !query 60
Expand Down Expand Up @@ -1124,34 +1124,130 @@ struct<INTERVAL '1 days':interval>


-- !query 119
select 1 year 2 days
select interval '1.41666666666666 year'
-- !query 119 schema
struct<INTERVAL '1 years 2 days':interval>
struct<INTERVAL '1 years 4 months':interval>
-- !query 119 output
1 years 2 days
1 years 4 months


-- !query 120
select '10-9' year to month
select interval '1.41666666666667 year'
-- !query 120 schema
struct<INTERVAL '10 years 9 months':interval>
struct<INTERVAL '1 years 5 months':interval>
-- !query 120 output
10 years 9 months
1 years 5 months


-- !query 121
select '20 15:40:32.99899999' day to second
select interval '1.1333333333301 months'
-- !query 121 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 121 output
20 days 15 hours 40 minutes 32.998999 seconds
1 months 3 days 23 hours 59 minutes 59.999992 seconds


-- !query 122
select 30 day day
select interval '1.133333333330 months'
-- !query 122 schema
struct<>
struct<INTERVAL '1 months 3 days 23 hours 59 minutes 59.999991 seconds':interval>
-- !query 122 output
1 months 3 days 23 hours 59 minutes 59.999991 seconds


-- !query 123
select interval '2.13333333 week'
-- !query 123 schema
struct<INTERVAL '14 days 22 hours 23 minutes 59.997984 seconds':interval>
-- !query 123 output
14 days 22 hours 23 minutes 59.997984 seconds


-- !query 124
select interval '2.13333334 week'
-- !query 124 schema
struct<INTERVAL '14 days 22 hours 24 minutes 0.004032 seconds':interval>
-- !query 124 output
14 days 22 hours 24 minutes 0.004032 seconds


-- !query 125
select interval '0.1 seconds'
-- !query 125 schema
struct<INTERVAL '0.1 seconds':interval>
-- !query 125 output
0.1 seconds


-- !query 126
select interval '0.49 microseconds'
-- !query 126 schema
struct<INTERVAL '0 seconds':interval>
-- !query 126 output
0 seconds


-- !query 127
select interval '0.50 microseconds'
-- !query 127 schema
struct<INTERVAL '0.000001 seconds':interval>
-- !query 127 output
0.000001 seconds


-- !query 128
select interval '87649415 hours 59 minutes 59 seconds 999 milliseconds 999 microseconds'
-- !query 128 schema
struct<INTERVAL '87649415 hours 59 minutes 59.999999 seconds':interval>
-- !query 128 output
87649415 hours 59 minutes 59.999999 seconds


-- !query 129
select interval '-0.51 year'
-- !query 129 schema
struct<INTERVAL '-6 months':interval>
-- !query 129 output
-6 months


-- !query 130
select interval '-0.41 year'
-- !query 130 schema
struct<INTERVAL '-4 months':interval>
-- !query 130 output
-4 months


-- !query 131
select 1 year 2 days
-- !query 131 schema
struct<INTERVAL '1 years 2 days':interval>
-- !query 131 output
1 years 2 days


-- !query 132
select '10-9' year to month
-- !query 132 schema
struct<INTERVAL '10 years 9 months':interval>
-- !query 132 output
10 years 9 months


-- !query 133
select '20 15:40:32.99899999' day to second
-- !query 133 schema
struct<INTERVAL '20 days 15 hours 40 minutes 32.998999 seconds':interval>
-- !query 133 output
20 days 15 hours 40 minutes 32.998999 seconds


-- !query 134
select 30 day day
-- !query 134 schema
struct<>
-- !query 134 output
org.apache.spark.sql.catalyst.parser.ParseException

no viable alternative at input 'day'(line 1, pos 14)
Expand All @@ -1161,27 +1257,27 @@ select 30 day day
--------------^^^


-- !query 123
-- !query 135
select date'2012-01-01' - '2-2' year to month
-- !query 123 schema
-- !query 135 schema
struct<CAST(CAST(DATE '2012-01-01' AS TIMESTAMP) - INTERVAL '2 years 2 months' AS DATE):date>
-- !query 123 output
-- !query 135 output
2009-11-01


-- !query 124
-- !query 136
select 1 month - 1 day
-- !query 124 schema
-- !query 136 schema
struct<INTERVAL '1 months -1 days':interval>
-- !query 124 output
-- !query 136 output
1 months -1 days


-- !query 125
-- !query 137
select 1 year to month
-- !query 125 schema
-- !query 137 schema
struct<>
-- !query 125 output
-- !query 137 output
org.apache.spark.sql.catalyst.parser.ParseException

The value of from-to unit must be a string(line 1, pos 7)
Expand All @@ -1191,11 +1287,11 @@ select 1 year to month
-------^^^


-- !query 126
-- !query 138
select '1' year to second
-- !query 126 schema
-- !query 138 schema
struct<>
-- !query 126 output
-- !query 138 output
org.apache.spark.sql.catalyst.parser.ParseException

Intervals FROM year TO second are not supported.(line 1, pos 7)
Expand All @@ -1205,11 +1301,11 @@ select '1' year to second
-------^^^


-- !query 127
-- !query 139
select 1 year '2-1' year to month
-- !query 127 schema
-- !query 139 schema
struct<>
-- !query 127 output
-- !query 139 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)
Expand All @@ -1219,11 +1315,11 @@ select 1 year '2-1' year to month
--------------^^^


-- !query 128
-- !query 140
select (-30) day
-- !query 128 schema
-- !query 140 schema
struct<>
-- !query 128 output
-- !query 140 output
org.apache.spark.sql.catalyst.parser.ParseException

no viable alternative at input 'day'(line 1, pos 13)
Expand All @@ -1233,11 +1329,11 @@ select (-30) day
-------------^^^


-- !query 129
-- !query 141
select (a + 1) day
-- !query 129 schema
-- !query 141 schema
struct<>
-- !query 129 output
-- !query 141 output
org.apache.spark.sql.catalyst.parser.ParseException

no viable alternative at input 'day'(line 1, pos 15)
Expand All @@ -1247,11 +1343,11 @@ select (a + 1) day
---------------^^^


-- !query 130
-- !query 142
select 30 day day day
-- !query 130 schema
-- !query 142 schema
struct<>
-- !query 130 output
-- !query 142 output
org.apache.spark.sql.catalyst.parser.ParseException

no viable alternative at input 'day'(line 1, pos 14)
Expand Down
Loading