Skip to content
Closed
Prev Previous commit
Next Next commit
regen golden file
  • Loading branch information
yaooqinn committed Nov 19, 2019
commit a5e2811b5f3c0f1d5d261731e688a9969620acef
156 changes: 118 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: 130
-- Number of queries: 140


-- !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 @@ -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'
Copy link
Member Author

Choose a reason for hiding this comment

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

this case is different from PG

postgres=# select interval '0.5 us';
 interval
----------
 00:00:00
(1 row)

postgres=# select interval '0.51 us';
    interval
-----------------
 00:00:00.000001
(1 row)

-- !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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down
86 changes: 83 additions & 3 deletions sql/core/src/test/resources/sql-tests/results/interval.sql.out
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 118
-- Number of queries: 128


-- !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


-- !query 60
Expand Down Expand Up @@ -1097,3 +1097,83 @@ from interval_arithmetic
struct<(INTERVAL '99 days 11 hours 22 minutes 33.123456 seconds' + INTERVAL '10 days 9 hours 8 minutes 7.123456 seconds'):interval,(INTERVAL '99 days 11 hours 22 minutes 33.123456 seconds' - INTERVAL '10 days 9 hours 8 minutes 7.123456 seconds'):interval>
-- !query 117 output
109 days 20 hours 30 minutes 40.246912 seconds 89 days 2 hours 14 minutes 26 seconds


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


-- !query 119
select interval '1.41666666666667 year'
-- !query 119 schema
struct<INTERVAL '1 years 5 months':interval>
-- !query 119 output
1 years 5 months


-- !query 120
select interval '1.1333333333301 months'
-- !query 120 schema
struct<INTERVAL '1 months 3 days 23 hours 59 minutes 59.999992 seconds':interval>
-- !query 120 output
1 months 3 days 23 hours 59 minutes 59.999992 seconds


-- !query 121
select interval '1.133333333330 months'
-- !query 121 schema
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