Skip to content

Commit 1e78a4e

Browse files
committed
fix tests
1 parent 47d7322 commit 1e78a4e

File tree

3 files changed

+73
-35
lines changed

3 files changed

+73
-35
lines changed

sql/core/src/test/resources/sql-tests/inputs/datetime-formatting.sql

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
--- TESTS FOR DATETIME FORMATTING FUNCTIONS ---
22

33
-- valid formatter pattern check
4-
create temporary view v as select t from values
4+
create temporary view v as select col from values
55
(timestamp '1582-06-01 11:33:33.123UTC+080000'),
66
(timestamp '1970-01-01 00:00:00.000Europe/Paris'),
77
(timestamp '1970-12-31 23:59:59.999Asia/Srednekolymsk'),

sql/core/src/test/resources/sql-tests/results/datetime-formatting-legacy.sql.out

Lines changed: 30 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
-- !query
6-
create temporary view v as select t from values
6+
create temporary view v as select col from values
77
(timestamp '1582-06-01 11:33:33.123UTC+080000'),
88
(timestamp '1970-01-01 00:00:00.000Europe/Paris'),
99
(timestamp '1970-12-31 23:59:59.999Asia/Srednekolymsk'),
@@ -14,53 +14,67 @@ create temporary view v as select t from values
1414
-- !query schema
1515
struct<>
1616
-- !query output
17-
org.apache.spark.sql.AnalysisException
18-
cannot resolve '`t`' given input columns: [t.col]; line 1 pos 34
17+
1918

2019

2120
-- !query
2221
select col, date_format(col, 'Y-w-u YYYY-ww-uu YYY-W-uuu YY YYYYY uuuu E EE EEE EEEE') from v
2322
-- !query schema
24-
struct<>
23+
struct<col:timestamp,date_format(col, Y-w-u YYYY-ww-uu YYY-W-uuu YY YYYYY uuuu E EE EEE EEEE):string>
2524
-- !query output
26-
org.apache.spark.sql.AnalysisException
27-
Table or view not found: v; line 1 pos 92
25+
1582-05-31 19:40:35.123 1582-22-4 1582-22-04 1582-5-004 82 01582 0004 Thu Thu Thu Thursday
26+
1969-12-31 15:00:00 1970-1-3 1970-01-03 1970-5-003 70 01970 0003 Wed Wed Wed Wednesday
27+
1970-12-31 04:59:59.999 1970-53-4 1970-53-04 1970-5-004 70 01970 0004 Thu Thu Thu Thursday
28+
1996-03-31 07:03:33.123 1996-13-7 1996-13-07 1996-4-007 96 01996 0007 Sun Sun Sun Sunday
29+
2018-11-17 05:33:33.123 2018-46-6 2018-46-06 2018-3-006 18 02018 0006 Sat Sat Sat Saturday
30+
2019-12-31 09:33:33.123 2020-1-2 2020-01-02 2020-5-002 20 02020 0002 Tue Tue Tue Tuesday
31+
2100-01-01 01:33:33.123 2099-53-5 2099-53-05 2099-0-005 99 02099 0005 Fri Fri Fri Friday
2832

2933

3034
-- !query
3135
select col, date_format(col, 'q qq Q QQ QQQ QQQQ') from v
3236
-- !query schema
3337
struct<>
3438
-- !query output
35-
org.apache.spark.sql.AnalysisException
36-
Table or view not found: v; line 1 pos 56
39+
java.lang.IllegalArgumentException
40+
Illegal pattern character 'q'
3741

3842

3943
-- !query
4044
select col, date_format(col, 'y-M-d H:m:s yyyy-MM-dd HH:mm:ss.SSS yy yyy yyyyy MMM MMMM L LL F h hh k kk K KK a') from v
4145
-- !query schema
42-
struct<>
46+
struct<col:timestamp,date_format(col, y-M-d H:m:s yyyy-MM-dd HH:mm:ss.SSS yy yyy yyyyy MMM MMMM L LL F h hh k kk K KK a):string>
4347
-- !query output
44-
org.apache.spark.sql.AnalysisException
45-
Table or view not found: v; line 1 pos 119
48+
1582-05-31 19:40:35.123 1582-5-31 19:40:35 1582-05-31 19:40:35.123 82 1582 01582 May May 5 05 5 7 07 19 19 7 07 PM
49+
1969-12-31 15:00:00 1969-12-31 15:0:0 1969-12-31 15:00:00.000 69 1969 01969 Dec December 12 12 5 3 03 15 15 3 03 PM
50+
1970-12-31 04:59:59.999 1970-12-31 4:59:59 1970-12-31 04:59:59.999 70 1970 01970 Dec December 12 12 5 4 04 4 04 4 04 AM
51+
1996-03-31 07:03:33.123 1996-3-31 7:3:33 1996-03-31 07:03:33.123 96 1996 01996 Mar March 3 03 5 7 07 7 07 7 07 AM
52+
2018-11-17 05:33:33.123 2018-11-17 5:33:33 2018-11-17 05:33:33.123 18 2018 02018 Nov November 11 11 3 5 05 5 05 5 05 AM
53+
2019-12-31 09:33:33.123 2019-12-31 9:33:33 2019-12-31 09:33:33.123 19 2019 02019 Dec December 12 12 5 9 09 9 09 9 09 AM
54+
2100-01-01 01:33:33.123 2100-1-1 1:33:33 2100-01-01 01:33:33.123 00 2100 02100 Jan January 1 01 1 1 01 1 01 1 01 AM
4655

4756

4857
-- !query
4958
select col, date_format(col, 'z zz zzz zzzz X XX XXX Z ZZ ZZZ ZZZZ ZZZZZ') from v
5059
-- !query schema
51-
struct<>
60+
struct<col:timestamp,date_format(col, z zz zzz zzzz X XX XXX Z ZZ ZZZ ZZZZ ZZZZZ):string>
5261
-- !query output
53-
org.apache.spark.sql.AnalysisException
54-
Table or view not found: v; line 1 pos 81
62+
1582-05-31 19:40:35.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 -0800 -0800
63+
1969-12-31 15:00:00 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 -0800 -0800
64+
1970-12-31 04:59:59.999 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 -0800 -0800
65+
1996-03-31 07:03:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 -0800 -0800
66+
2018-11-17 05:33:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 -0800 -0800
67+
2019-12-31 09:33:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 -0800 -0800
68+
2100-01-01 01:33:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 -0800 -0800
5569

5670

5771
-- !query
5872
select col, date_format(col, 'VV O OOOO XXXX XXXXX x xx xxx xxxx xxxx xxxxx') from v
5973
-- !query schema
6074
struct<>
6175
-- !query output
62-
org.apache.spark.sql.AnalysisException
63-
Table or view not found: v; line 1 pos 83
76+
java.lang.IllegalArgumentException
77+
Illegal pattern character 'V'
6478

6579

6680
-- !query

sql/core/src/test/resources/sql-tests/results/datetime-formatting.sql.out

Lines changed: 42 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44

55
-- !query
6-
create temporary view v as select t from values
6+
create temporary view v as select col from values
77
(timestamp '1582-06-01 11:33:33.123UTC+080000'),
88
(timestamp '1970-01-01 00:00:00.000Europe/Paris'),
99
(timestamp '1970-12-31 23:59:59.999Asia/Srednekolymsk'),
@@ -14,53 +14,77 @@ create temporary view v as select t from values
1414
-- !query schema
1515
struct<>
1616
-- !query output
17-
org.apache.spark.sql.AnalysisException
18-
cannot resolve '`t`' given input columns: [t.col]; line 1 pos 34
17+
1918

2019

2120
-- !query
2221
select col, date_format(col, 'Y-w-u YYYY-ww-uu YYY-W-uuu YY YYYYY uuuu E EE EEE EEEE') from v
2322
-- !query schema
24-
struct<>
23+
struct<col:timestamp,date_format(col, Y-w-u YYYY-ww-uu YYY-W-uuu YY YYYYY uuuu E EE EEE EEEE):string>
2524
-- !query output
26-
org.apache.spark.sql.AnalysisException
27-
Table or view not found: v; line 1 pos 92
25+
1582-05-31 19:40:35.123 1582-22-1 1582-22-01 1582-5-Mon 82 01582 Monday Mon Mon Mon Monday
26+
1969-12-31 15:00:00 1970-1-3 1970-01-03 1970-5-Wed 70 01970 Wednesday Wed Wed Wed Wednesday
27+
1970-12-31 04:59:59.999 1970-53-4 1970-53-04 1970-5-Thu 70 01970 Thursday Thu Thu Thu Thursday
28+
1996-03-31 07:03:33.123 1996-13-7 1996-13-07 1996-4-Sun 96 01996 Sunday Sun Sun Sun Sunday
29+
2018-11-17 05:33:33.123 2018-46-6 2018-46-06 2018-3-Sat 18 02018 Saturday Sat Sat Sat Saturday
30+
2019-12-31 09:33:33.123 2020-1-2 2020-01-02 2020-5-Tue 20 02020 Tuesday Tue Tue Tue Tuesday
31+
2100-01-01 01:33:33.123 2099-53-5 2099-53-05 2099-0-Fri 99 02099 Friday Fri Fri Fri Friday
2832

2933

3034
-- !query
3135
select col, date_format(col, 'q qq Q QQ QQQ QQQQ') from v
3236
-- !query schema
33-
struct<>
37+
struct<col:timestamp,date_format(col, q qq Q QQ QQQ QQQQ):string>
3438
-- !query output
35-
org.apache.spark.sql.AnalysisException
36-
Table or view not found: v; line 1 pos 56
39+
1582-05-31 19:40:35.123 2 02 2 02 Q2 2nd quarter
40+
1969-12-31 15:00:00 4 04 4 04 Q4 4th quarter
41+
1970-12-31 04:59:59.999 4 04 4 04 Q4 4th quarter
42+
1996-03-31 07:03:33.123 1 01 1 01 Q1 1st quarter
43+
2018-11-17 05:33:33.123 4 04 4 04 Q4 4th quarter
44+
2019-12-31 09:33:33.123 4 04 4 04 Q4 4th quarter
45+
2100-01-01 01:33:33.123 1 01 1 01 Q1 1st quarter
3746

3847

3948
-- !query
4049
select col, date_format(col, 'y-M-d H:m:s yyyy-MM-dd HH:mm:ss.SSS yy yyy yyyyy MMM MMMM L LL F h hh k kk K KK a') from v
4150
-- !query schema
42-
struct<>
51+
struct<col:timestamp,date_format(col, y-M-d H:m:s yyyy-MM-dd HH:mm:ss.SSS yy yyy yyyyy MMM MMMM L LL F h hh k kk K KK a):string>
4352
-- !query output
44-
org.apache.spark.sql.AnalysisException
45-
Table or view not found: v; line 1 pos 119
53+
1582-05-31 19:40:35.123 1582-5-31 19:40:35 1582-05-31 19:40:35.123 82 1582 01582 May May 5 05 3 7 07 19 19 7 07 PM
54+
1969-12-31 15:00:00 1969-12-31 15:0:0 1969-12-31 15:00:00.000 69 1969 01969 Dec December 12 12 3 3 03 15 15 3 03 PM
55+
1970-12-31 04:59:59.999 1970-12-31 4:59:59 1970-12-31 04:59:59.999 70 1970 01970 Dec December 12 12 3 4 04 4 04 4 04 AM
56+
1996-03-31 07:03:33.123 1996-3-31 7:3:33 1996-03-31 07:03:33.123 96 1996 01996 Mar March 3 03 3 7 07 7 07 7 07 AM
57+
2018-11-17 05:33:33.123 2018-11-17 5:33:33 2018-11-17 05:33:33.123 18 2018 02018 Nov November 11 11 3 5 05 5 05 5 05 AM
58+
2019-12-31 09:33:33.123 2019-12-31 9:33:33 2019-12-31 09:33:33.123 19 2019 02019 Dec December 12 12 3 9 09 9 09 9 09 AM
59+
2100-01-01 01:33:33.123 2100-1-1 1:33:33 2100-01-01 01:33:33.123 00 2100 02100 Jan January 1 01 1 1 01 1 01 1 01 AM
4660

4761

4862
-- !query
4963
select col, date_format(col, 'z zz zzz zzzz X XX XXX Z ZZ ZZZ ZZZZ ZZZZZ') from v
5064
-- !query schema
51-
struct<>
65+
struct<col:timestamp,date_format(col, z zz zzz zzzz X XX XXX Z ZZ ZZZ ZZZZ ZZZZZ):string>
5266
-- !query output
53-
org.apache.spark.sql.AnalysisException
54-
Table or view not found: v; line 1 pos 81
67+
1582-05-31 19:40:35.123 PST PST PST Pacific Standard Time -0752 -0752 -07:52 -0752 -0752 -0752 GMT-07:52:58 -07:52:58
68+
1969-12-31 15:00:00 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 GMT-08:00 -08:00
69+
1970-12-31 04:59:59.999 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 GMT-08:00 -08:00
70+
1996-03-31 07:03:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 GMT-08:00 -08:00
71+
2018-11-17 05:33:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 GMT-08:00 -08:00
72+
2019-12-31 09:33:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 GMT-08:00 -08:00
73+
2100-01-01 01:33:33.123 PST PST PST Pacific Standard Time -08 -0800 -08:00 -0800 -0800 -0800 GMT-08:00 -08:00
5574

5675

5776
-- !query
5877
select col, date_format(col, 'VV O OOOO XXXX XXXXX x xx xxx xxxx xxxx xxxxx') from v
5978
-- !query schema
60-
struct<>
79+
struct<col:timestamp,date_format(col, VV O OOOO XXXX XXXXX x xx xxx xxxx xxxx xxxxx):string>
6180
-- !query output
62-
org.apache.spark.sql.AnalysisException
63-
Table or view not found: v; line 1 pos 83
81+
1582-05-31 19:40:35.123 America/Los_Angeles GMT-7:52:58 GMT-07:52:58 -075258 -07:52:58 -0752 -0752 -07:52 -075258 -075258 -07:52:58
82+
1969-12-31 15:00:00 America/Los_Angeles GMT-8 GMT-08:00 -0800 -08:00 -08 -0800 -08:00 -0800 -0800 -08:00
83+
1970-12-31 04:59:59.999 America/Los_Angeles GMT-8 GMT-08:00 -0800 -08:00 -08 -0800 -08:00 -0800 -0800 -08:00
84+
1996-03-31 07:03:33.123 America/Los_Angeles GMT-8 GMT-08:00 -0800 -08:00 -08 -0800 -08:00 -0800 -0800 -08:00
85+
2018-11-17 05:33:33.123 America/Los_Angeles GMT-8 GMT-08:00 -0800 -08:00 -08 -0800 -08:00 -0800 -0800 -08:00
86+
2019-12-31 09:33:33.123 America/Los_Angeles GMT-8 GMT-08:00 -0800 -08:00 -08 -0800 -08:00 -0800 -0800 -08:00
87+
2100-01-01 01:33:33.123 America/Los_Angeles GMT-8 GMT-08:00 -0800 -08:00 -08 -0800 -08:00 -0800 -0800 -08:00
6488

6589

6690
-- !query

0 commit comments

Comments
 (0)