Skip to content

Commit 88ca4c2

Browse files
committed
Capitalize SQL keywords
1 parent caea82a commit 88ca4c2

4 files changed

Lines changed: 56 additions & 66 deletions

File tree

sql/core/src/test/resources/sql-tests/inputs/like-all.sql

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,34 @@ CREATE OR REPLACE TEMPORARY VIEW like_all_table AS SELECT * FROM (VALUES
44
('linkedin', '%in'))
55
as t1(company, pat);
66

7-
select company from like_all_table where company like all ('%oo%', '%go%');
7+
SELECT company FROM like_all_table WHERE company LIKE ALL ('%oo%', '%go%');
88

9-
select company from like_all_table where company like all ('microsoft', '%yoo%');
9+
SELECT company FROM like_all_table WHERE company LIKE ALL ('microsoft', '%yoo%');
1010

11-
select
11+
SELECT
1212
company,
1313
CASE
14-
WHEN company like all ('%oo%', '%go%') THEN 'Y'
14+
WHEN company LIKE ALL ('%oo%', '%go%') THEN 'Y'
1515
ELSE 'N'
1616
END AS is_available,
1717
CASE
18-
WHEN company like all ('%oo%', 'go%') OR company like all ('%in', 'ms%') THEN 'Y'
18+
WHEN company LIKE ALL ('%oo%', 'go%') OR company LIKE ALL ('%in', 'ms%') THEN 'Y'
1919
ELSE 'N'
2020
END AS mix
21-
From like_all_table ;
21+
FROM like_all_table ;
2222

2323
-- Mix test with constant pattern and column value
24-
select company from like_all_table where company like all ('%oo%', pat);
24+
SELECT company FROM like_all_table WHERE company LIKE ALL ('%oo%', pat);
2525

2626
-- not like all test
27-
28-
select company from like_all_table where company not like all ('%oo%', '%in', 'fa%');
29-
select company from like_all_table where company not like all ('microsoft', '%yoo%');
27+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL ('%oo%', '%in', 'fa%');
28+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL ('microsoft', '%yoo%');
3029

3130
-- null test
32-
33-
select company from like_all_table where company like all ('%oo%', null);
34-
35-
select company from like_all_table where company not like all ('%oo%', null);
36-
37-
select company from like_all_table where company not like all (null, null);
38-
39-
select company from like_all_table where company not like all (null, null);
31+
SELECT company FROM like_all_table WHERE company LIKE ALL ('%oo%', NULL);
32+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL ('%oo%', NULL);
33+
SELECT company FROM like_all_table WHERE company LIKE ALL (NULL, NULL);
34+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL (NULL, NULL);
4035

4136
-- negative case
42-
select company from like_any_table where company like all ();
37+
SELECT company FROM like_any_table WHERE company LIKE ALL ();

sql/core/src/test/resources/sql-tests/inputs/like-any.sql

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4,39 +4,34 @@ CREATE OR REPLACE TEMPORARY VIEW like_any_table AS SELECT * FROM (VALUES
44
('linkedin', '%in'))
55
as t1(company, pat);
66

7-
select company from like_any_table where company like any ('%oo%', '%in', 'fa%');
7+
SELECT company FROM like_any_table WHERE company LIKE ANY ('%oo%', '%in', 'fa%');
88

9-
select company from like_any_table where company like any ('microsoft', '%yoo%');
9+
SELECT company FROM like_any_table WHERE company LIKE ANY ('microsoft', '%yoo%');
1010

1111
select
1212
company,
1313
CASE
14-
WHEN company like any ('%oo%', '%in', 'fa%') THEN 'Y'
14+
WHEN company LIKE ANY ('%oo%', '%in', 'fa%') THEN 'Y'
1515
ELSE 'N'
1616
END AS is_available,
1717
CASE
18-
WHEN company like any ('%oo%', 'fa%') OR company like any ('%in', 'ms%') THEN 'Y'
18+
WHEN company LIKE ANY ('%oo%', 'fa%') OR company LIKE ANY ('%in', 'ms%') THEN 'Y'
1919
ELSE 'N'
2020
END AS mix
21-
From like_any_table;
21+
FROM like_any_table;
2222

2323
-- Mix test with constant pattern and column value
24-
select company from like_any_table where company like any ('%zz%', pat);
24+
SELECT company FROM like_any_table WHERE company LIKE ANY ('%zz%', pat);
2525

2626
-- not like any test
27-
28-
select company from like_any_table where company not like any ('%oo%', '%in', 'fa%');
29-
select company from like_any_table where company not like any ('microsoft', '%yoo%');
27+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY ('%oo%', '%in', 'fa%');
28+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY ('microsoft', '%yoo%');
3029

3130
-- null test
32-
33-
select company from like_any_table where company like any ('%oo%', null);
34-
35-
select company from like_any_table where company not like any ('%oo%', null);
36-
37-
select company from like_any_table where company like any (null, null);
38-
39-
select company from like_any_table where company not like any (null, null);
31+
SELECT company FROM like_any_table WHERE company LIKE ANY ('%oo%', NULL);
32+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY ('%oo%', NULL);
33+
SELECT company FROM like_any_table WHERE company LIKE ANY (NULL, NULL);
34+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY (NULL, NULL);
4035

4136
-- negative case
42-
select company from like_any_table where company like any ();
37+
SELECT company FROM like_any_table WHERE company LIKE ANY ();

sql/core/src/test/resources/sql-tests/results/like-all.sql.out

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,33 @@ struct<>
1515

1616

1717
-- !query
18-
select company from like_all_table where company like all ('%oo%', '%go%')
18+
SELECT company FROM like_all_table WHERE company LIKE ALL ('%oo%', '%go%')
1919
-- !query schema
2020
struct<company:string>
2121
-- !query output
2222
google
2323

2424

2525
-- !query
26-
select company from like_all_table where company like all ('microsoft', '%yoo%')
26+
SELECT company FROM like_all_table WHERE company LIKE ALL ('microsoft', '%yoo%')
2727
-- !query schema
2828
struct<company:string>
2929
-- !query output
3030

3131

3232

3333
-- !query
34-
select
34+
SELECT
3535
company,
3636
CASE
37-
WHEN company like all ('%oo%', '%go%') THEN 'Y'
37+
WHEN company LIKE ALL ('%oo%', '%go%') THEN 'Y'
3838
ELSE 'N'
3939
END AS is_available,
4040
CASE
41-
WHEN company like all ('%oo%', 'go%') OR company like all ('%in', 'ms%') THEN 'Y'
41+
WHEN company LIKE ALL ('%oo%', 'go%') OR company LIKE ALL ('%in', 'ms%') THEN 'Y'
4242
ELSE 'N'
4343
END AS mix
44-
From like_all_table
44+
FROM like_all_table
4545
-- !query schema
4646
struct<company:string,is_available:string,mix:string>
4747
-- !query output
@@ -51,7 +51,7 @@ linkedin N N
5151

5252

5353
-- !query
54-
select company from like_all_table where company like all ('%oo%', pat)
54+
SELECT company FROM like_all_table WHERE company LIKE ALL ('%oo%', pat)
5555
-- !query schema
5656
struct<company:string>
5757
-- !query output
@@ -60,15 +60,15 @@ google
6060

6161

6262
-- !query
63-
select company from like_all_table where company not like all ('%oo%', '%in', 'fa%')
63+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL ('%oo%', '%in', 'fa%')
6464
-- !query schema
6565
struct<company:string>
6666
-- !query output
6767

6868

6969

7070
-- !query
71-
select company from like_all_table where company not like all ('microsoft', '%yoo%')
71+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL ('microsoft', '%yoo%')
7272
-- !query schema
7373
struct<company:string>
7474
-- !query output
@@ -78,39 +78,39 @@ linkedin
7878

7979

8080
-- !query
81-
select company from like_all_table where company like all ('%oo%', null)
81+
SELECT company FROM like_all_table WHERE company LIKE ALL ('%oo%', NULL)
8282
-- !query schema
8383
struct<company:string>
8484
-- !query output
8585

8686

8787

8888
-- !query
89-
select company from like_all_table where company not like all ('%oo%', null)
89+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL ('%oo%', NULL)
9090
-- !query schema
9191
struct<company:string>
9292
-- !query output
9393

9494

9595

9696
-- !query
97-
select company from like_all_table where company not like all (null, null)
97+
SELECT company FROM like_all_table WHERE company LIKE ALL (NULL, NULL)
9898
-- !query schema
9999
struct<company:string>
100100
-- !query output
101101

102102

103103

104104
-- !query
105-
select company from like_all_table where company not like all (null, null)
105+
SELECT company FROM like_all_table WHERE company NOT LIKE ALL (NULL, NULL)
106106
-- !query schema
107107
struct<company:string>
108108
-- !query output
109109

110110

111111

112112
-- !query
113-
select company from like_any_table where company like all ()
113+
SELECT company FROM like_any_table WHERE company LIKE ALL ()
114114
-- !query schema
115115
struct<>
116116
-- !query output
@@ -119,5 +119,5 @@ org.apache.spark.sql.catalyst.parser.ParseException
119119
Syntax error: expected something between '(' and ')'.(line 1, pos 49)
120120

121121
== SQL ==
122-
select company from like_any_table where company like all ()
122+
SELECT company FROM like_any_table WHERE company LIKE ALL ()
123123
-------------------------------------------------^^^

sql/core/src/test/resources/sql-tests/results/like-any.sql.out

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ struct<>
1515

1616

1717
-- !query
18-
select company from like_any_table where company like any ('%oo%', '%in', 'fa%')
18+
SELECT company FROM like_any_table WHERE company LIKE ANY ('%oo%', '%in', 'fa%')
1919
-- !query schema
2020
struct<company:string>
2121
-- !query output
@@ -25,7 +25,7 @@ linkedin
2525

2626

2727
-- !query
28-
select company from like_any_table where company like any ('microsoft', '%yoo%')
28+
SELECT company FROM like_any_table WHERE company LIKE ANY ('microsoft', '%yoo%')
2929
-- !query schema
3030
struct<company:string>
3131
-- !query output
@@ -36,14 +36,14 @@ struct<company:string>
3636
select
3737
company,
3838
CASE
39-
WHEN company like any ('%oo%', '%in', 'fa%') THEN 'Y'
39+
WHEN company LIKE ANY ('%oo%', '%in', 'fa%') THEN 'Y'
4040
ELSE 'N'
4141
END AS is_available,
4242
CASE
43-
WHEN company like any ('%oo%', 'fa%') OR company like any ('%in', 'ms%') THEN 'Y'
43+
WHEN company LIKE ANY ('%oo%', 'fa%') OR company LIKE ANY ('%in', 'ms%') THEN 'Y'
4444
ELSE 'N'
4545
END AS mix
46-
From like_any_table
46+
FROM like_any_table
4747
-- !query schema
4848
struct<company:string,is_available:string,mix:string>
4949
-- !query output
@@ -53,7 +53,7 @@ linkedin Y Y
5353

5454

5555
-- !query
56-
select company from like_any_table where company like any ('%zz%', pat)
56+
SELECT company FROM like_any_table WHERE company LIKE ANY ('%zz%', pat)
5757
-- !query schema
5858
struct<company:string>
5959
-- !query output
@@ -63,7 +63,7 @@ linkedin
6363

6464

6565
-- !query
66-
select company from like_any_table where company not like any ('%oo%', '%in', 'fa%')
66+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY ('%oo%', '%in', 'fa%')
6767
-- !query schema
6868
struct<company:string>
6969
-- !query output
@@ -73,7 +73,7 @@ linkedin
7373

7474

7575
-- !query
76-
select company from like_any_table where company not like any ('microsoft', '%yoo%')
76+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY ('microsoft', '%yoo%')
7777
-- !query schema
7878
struct<company:string>
7979
-- !query output
@@ -83,7 +83,7 @@ linkedin
8383

8484

8585
-- !query
86-
select company from like_any_table where company like any ('%oo%', null)
86+
SELECT company FROM like_any_table WHERE company LIKE ANY ('%oo%', NULL)
8787
-- !query schema
8888
struct<company:string>
8989
-- !query output
@@ -92,31 +92,31 @@ google
9292

9393

9494
-- !query
95-
select company from like_any_table where company not like any ('%oo%', null)
95+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY ('%oo%', NULL)
9696
-- !query schema
9797
struct<company:string>
9898
-- !query output
9999
linkedin
100100

101101

102102
-- !query
103-
select company from like_any_table where company like any (null, null)
103+
SELECT company FROM like_any_table WHERE company LIKE ANY (NULL, NULL)
104104
-- !query schema
105105
struct<company:string>
106106
-- !query output
107107

108108

109109

110110
-- !query
111-
select company from like_any_table where company not like any (null, null)
111+
SELECT company FROM like_any_table WHERE company NOT LIKE ANY (NULL, NULL)
112112
-- !query schema
113113
struct<company:string>
114114
-- !query output
115115

116116

117117

118118
-- !query
119-
select company from like_any_table where company like any ()
119+
SELECT company FROM like_any_table WHERE company LIKE ANY ()
120120
-- !query schema
121121
struct<>
122122
-- !query output
@@ -125,5 +125,5 @@ org.apache.spark.sql.catalyst.parser.ParseException
125125
Syntax error: expected something between '(' and ')'.(line 1, pos 49)
126126

127127
== SQL ==
128-
select company from like_any_table where company like any ()
128+
SELECT company FROM like_any_table WHERE company LIKE ANY ()
129129
-------------------------------------------------^^^

0 commit comments

Comments
 (0)