Skip to content

Commit 2e1c235

Browse files
committed
[SPARK-29359] Better exception handling in SQLQueryTestSuite and ThriftServerQueryTestSuite
1 parent 130e9ae commit 2e1c235

File tree

82 files changed

+1298
-1298
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

82 files changed

+1298
-1298
lines changed

sql/core/src/test/resources/sql-tests/results/ansi/interval.sql.out

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ interval 4 weeks 2 days
290290
-- !query 22
291291
select 30 day day
292292
-- !query 22 schema
293-
struct<>
293+
294294
-- !query 22 output
295295
org.apache.spark.sql.catalyst.parser.ParseException
296296

@@ -304,7 +304,7 @@ select 30 day day
304304
-- !query 23
305305
select 30 day day day
306306
-- !query 23 schema
307-
struct<>
307+
308308
-- !query 23 output
309309
org.apache.spark.sql.catalyst.parser.ParseException
310310

@@ -326,7 +326,7 @@ struct<CAST(CAST(DATE '2012-01-01' AS TIMESTAMP) - interval 4 weeks 2 days AS DA
326326
-- !query 25
327327
select date '2012-01-01' - 30 day day
328328
-- !query 25 schema
329-
struct<>
329+
330330
-- !query 25 output
331331
org.apache.spark.sql.catalyst.parser.ParseException
332332

@@ -340,7 +340,7 @@ select date '2012-01-01' - 30 day day
340340
-- !query 26
341341
select date '2012-01-01' - 30 day day day
342342
-- !query 26 schema
343-
struct<>
343+
344344
-- !query 26 output
345345
org.apache.spark.sql.catalyst.parser.ParseException
346346

@@ -370,7 +370,7 @@ struct<CAST(CAST(DATE '2012-01-01' AS TIMESTAMP) + interval -4 weeks -2 days AS
370370
-- !query 29
371371
select date '2012-01-01' + interval (-30) day
372372
-- !query 29 schema
373-
struct<>
373+
374374
-- !query 29 output
375375
org.apache.spark.sql.catalyst.parser.ParseException
376376

@@ -384,7 +384,7 @@ select date '2012-01-01' + interval (-30) day
384384
-- !query 30
385385
select date '2012-01-01' + (-30) day
386386
-- !query 30 schema
387-
struct<>
387+
388388
-- !query 30 output
389389
org.apache.spark.sql.catalyst.parser.ParseException
390390

@@ -406,7 +406,7 @@ struct<>
406406
-- !query 32
407407
select date '2012-01-01' + interval (a + 1) day from t
408408
-- !query 32 schema
409-
struct<>
409+
410410
-- !query 32 output
411411
org.apache.spark.sql.catalyst.parser.ParseException
412412

@@ -420,7 +420,7 @@ select date '2012-01-01' + interval (a + 1) day from t
420420
-- !query 33
421421
select date '2012-01-01' + (a + 1) day from t
422422
-- !query 33 schema
423-
struct<>
423+
424424
-- !query 33 output
425425
org.apache.spark.sql.catalyst.parser.ParseException
426426

sql/core/src/test/resources/sql-tests/results/array.sql.out

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct<sort_array(boolean_array, true):array<boolean>,sort_array(tinyint_array,
128128
-- !query 9
129129
select sort_array(array('b', 'd'), '1')
130130
-- !query 9 schema
131-
struct<>
131+
132132
-- !query 9 output
133133
org.apache.spark.sql.AnalysisException
134134
cannot resolve 'sort_array(array('b', 'd'), '1')' due to data type mismatch: Sort order in second argument requires a boolean literal.; line 1 pos 7
@@ -137,7 +137,7 @@ cannot resolve 'sort_array(array('b', 'd'), '1')' due to data type mismatch: Sor
137137
-- !query 10
138138
select sort_array(array('b', 'd'), cast(NULL as boolean))
139139
-- !query 10 schema
140-
struct<>
140+
141141
-- !query 10 output
142142
org.apache.spark.sql.AnalysisException
143143
cannot resolve 'sort_array(array('b', 'd'), CAST(NULL AS BOOLEAN))' due to data type mismatch: Sort order in second argument requires a boolean literal.; line 1 pos 7

sql/core/src/test/resources/sql-tests/results/change-column.sql.out

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ c int
2323
-- !query 2
2424
ALTER TABLE test_change CHANGE a a1 INT
2525
-- !query 2 schema
26-
struct<>
26+
2727
-- !query 2 output
2828
org.apache.spark.sql.AnalysisException
2929
ALTER TABLE CHANGE COLUMN is not supported for changing column 'a' with type 'IntegerType' to 'a1' with type 'IntegerType';
@@ -42,7 +42,7 @@ c int
4242
-- !query 4
4343
ALTER TABLE test_change CHANGE a a STRING
4444
-- !query 4 schema
45-
struct<>
45+
4646
-- !query 4 output
4747
org.apache.spark.sql.AnalysisException
4848
ALTER TABLE CHANGE COLUMN is not supported for changing column 'a' with type 'IntegerType' to 'a' with type 'StringType';
@@ -61,7 +61,7 @@ c int
6161
-- !query 6
6262
ALTER TABLE test_change CHANGE a a INT AFTER b
6363
-- !query 6 schema
64-
struct<>
64+
6565
-- !query 6 output
6666
org.apache.spark.sql.catalyst.parser.ParseException
6767

@@ -75,7 +75,7 @@ ALTER TABLE test_change CHANGE a a INT AFTER b
7575
-- !query 7
7676
ALTER TABLE test_change CHANGE b b STRING FIRST
7777
-- !query 7 schema
78-
struct<>
78+
7979
-- !query 7 output
8080
org.apache.spark.sql.catalyst.parser.ParseException
8181

@@ -151,7 +151,7 @@ c int
151151
-- !query 15
152152
ALTER TABLE test_change CHANGE invalid_col invalid_col INT
153153
-- !query 15 schema
154-
struct<>
154+
155155
-- !query 15 output
156156
org.apache.spark.sql.AnalysisException
157157
Can't find column `invalid_col` given table data columns [`a`, `b`, `c`];
@@ -170,7 +170,7 @@ c int
170170
-- !query 17
171171
ALTER TABLE test_change CHANGE a a1 STRING COMMENT 'this is column a1' AFTER b
172172
-- !query 17 schema
173-
struct<>
173+
174174
-- !query 17 output
175175
org.apache.spark.sql.catalyst.parser.ParseException
176176

@@ -218,7 +218,7 @@ spark.sql.caseSensitive true
218218
-- !query 22
219219
ALTER TABLE test_change CHANGE a A INT COMMENT 'this is column A1'
220220
-- !query 22 schema
221-
struct<>
221+
222222
-- !query 22 output
223223
org.apache.spark.sql.AnalysisException
224224
ALTER TABLE CHANGE COLUMN is not supported for changing column 'a' with type 'IntegerType' to 'A' with type 'IntegerType';
@@ -245,7 +245,7 @@ struct<>
245245
-- !query 25
246246
ALTER TABLE temp_view CHANGE a a INT COMMENT 'this is column a'
247247
-- !query 25 schema
248-
struct<>
248+
249249
-- !query 25 output
250250
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
251251
Table or view 'temp_view' not found in database 'default';
@@ -262,7 +262,7 @@ struct<>
262262
-- !query 27
263263
ALTER TABLE global_temp.global_temp_view CHANGE a a INT COMMENT 'this is column a'
264264
-- !query 27 schema
265-
struct<>
265+
266266
-- !query 27 output
267267
org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException
268268
Database 'global_temp' not found;
@@ -279,7 +279,7 @@ struct<>
279279
-- !query 29
280280
ALTER TABLE partition_table PARTITION (c = 1) CHANGE COLUMN a new_a INT
281281
-- !query 29 schema
282-
struct<>
282+
283283
-- !query 29 output
284284
org.apache.spark.sql.catalyst.parser.ParseException
285285

@@ -293,7 +293,7 @@ ALTER TABLE partition_table PARTITION (c = 1) CHANGE COLUMN a new_a INT
293293
-- !query 30
294294
ALTER TABLE partition_table CHANGE COLUMN c c INT COMMENT 'this is column C'
295295
-- !query 30 schema
296-
struct<>
296+
297297
-- !query 30 output
298298
org.apache.spark.sql.AnalysisException
299299
Can't find column `c` given table data columns [`a`, `b`];

sql/core/src/test/resources/sql-tests/results/columnresolution-negative.sql.out

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ struct<>
6969
-- !query 8
7070
SELECT i1 FROM t1, mydb1.t1
7171
-- !query 8 schema
72-
struct<>
72+
7373
-- !query 8 output
7474
org.apache.spark.sql.AnalysisException
7575
Reference 'i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7
@@ -78,7 +78,7 @@ Reference 'i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7
7878
-- !query 9
7979
SELECT t1.i1 FROM t1, mydb1.t1
8080
-- !query 9 schema
81-
struct<>
81+
8282
-- !query 9 output
8383
org.apache.spark.sql.AnalysisException
8484
Reference 't1.i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7
@@ -87,7 +87,7 @@ Reference 't1.i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos
8787
-- !query 10
8888
SELECT mydb1.t1.i1 FROM t1, mydb1.t1
8989
-- !query 10 schema
90-
struct<>
90+
9191
-- !query 10 output
9292
org.apache.spark.sql.AnalysisException
9393
Reference 'mydb1.t1.i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line 1 pos 7
@@ -96,7 +96,7 @@ Reference 'mydb1.t1.i1' is ambiguous, could be: mydb1.t1.i1, mydb1.t1.i1.; line
9696
-- !query 11
9797
SELECT i1 FROM t1, mydb2.t1
9898
-- !query 11 schema
99-
struct<>
99+
100100
-- !query 11 output
101101
org.apache.spark.sql.AnalysisException
102102
Reference 'i1' is ambiguous, could be: mydb1.t1.i1, mydb2.t1.i1.; line 1 pos 7
@@ -105,7 +105,7 @@ Reference 'i1' is ambiguous, could be: mydb1.t1.i1, mydb2.t1.i1.; line 1 pos 7
105105
-- !query 12
106106
SELECT t1.i1 FROM t1, mydb2.t1
107107
-- !query 12 schema
108-
struct<>
108+
109109
-- !query 12 output
110110
org.apache.spark.sql.AnalysisException
111111
Reference 't1.i1' is ambiguous, could be: mydb1.t1.i1, mydb2.t1.i1.; line 1 pos 7
@@ -122,7 +122,7 @@ struct<>
122122
-- !query 14
123123
SELECT i1 FROM t1, mydb1.t1
124124
-- !query 14 schema
125-
struct<>
125+
126126
-- !query 14 output
127127
org.apache.spark.sql.AnalysisException
128128
Reference 'i1' is ambiguous, could be: mydb2.t1.i1, mydb1.t1.i1.; line 1 pos 7
@@ -131,7 +131,7 @@ Reference 'i1' is ambiguous, could be: mydb2.t1.i1, mydb1.t1.i1.; line 1 pos 7
131131
-- !query 15
132132
SELECT t1.i1 FROM t1, mydb1.t1
133133
-- !query 15 schema
134-
struct<>
134+
135135
-- !query 15 output
136136
org.apache.spark.sql.AnalysisException
137137
Reference 't1.i1' is ambiguous, could be: mydb2.t1.i1, mydb1.t1.i1.; line 1 pos 7
@@ -140,7 +140,7 @@ Reference 't1.i1' is ambiguous, could be: mydb2.t1.i1, mydb1.t1.i1.; line 1 pos
140140
-- !query 16
141141
SELECT i1 FROM t1, mydb2.t1
142142
-- !query 16 schema
143-
struct<>
143+
144144
-- !query 16 output
145145
org.apache.spark.sql.AnalysisException
146146
Reference 'i1' is ambiguous, could be: mydb2.t1.i1, mydb2.t1.i1.; line 1 pos 7
@@ -149,7 +149,7 @@ Reference 'i1' is ambiguous, could be: mydb2.t1.i1, mydb2.t1.i1.; line 1 pos 7
149149
-- !query 17
150150
SELECT t1.i1 FROM t1, mydb2.t1
151151
-- !query 17 schema
152-
struct<>
152+
153153
-- !query 17 output
154154
org.apache.spark.sql.AnalysisException
155155
Reference 't1.i1' is ambiguous, could be: mydb2.t1.i1, mydb2.t1.i1.; line 1 pos 7
@@ -158,7 +158,7 @@ Reference 't1.i1' is ambiguous, could be: mydb2.t1.i1, mydb2.t1.i1.; line 1 pos
158158
-- !query 18
159159
SELECT db1.t1.i1 FROM t1, mydb2.t1
160160
-- !query 18 schema
161-
struct<>
161+
162162
-- !query 18 output
163163
org.apache.spark.sql.AnalysisException
164164
cannot resolve '`db1.t1.i1`' given input columns: [mydb2.t1.i1, mydb2.t1.i1]; line 1 pos 7
@@ -183,7 +183,7 @@ struct<>
183183
-- !query 21
184184
SELECT mydb1.t1 FROM t1
185185
-- !query 21 schema
186-
struct<>
186+
187187
-- !query 21 output
188188
org.apache.spark.sql.AnalysisException
189189
cannot resolve '`mydb1.t1`' given input columns: [mydb1.t1.i1]; line 1 pos 7
@@ -192,7 +192,7 @@ cannot resolve '`mydb1.t1`' given input columns: [mydb1.t1.i1]; line 1 pos 7
192192
-- !query 22
193193
SELECT t1.x.y.* FROM t1
194194
-- !query 22 schema
195-
struct<>
195+
196196
-- !query 22 output
197197
org.apache.spark.sql.AnalysisException
198198
cannot resolve 't1.x.y.*' given input columns 'i1';
@@ -201,7 +201,7 @@ cannot resolve 't1.x.y.*' given input columns 'i1';
201201
-- !query 23
202202
SELECT t1 FROM mydb1.t1
203203
-- !query 23 schema
204-
struct<>
204+
205205
-- !query 23 output
206206
org.apache.spark.sql.AnalysisException
207207
cannot resolve '`t1`' given input columns: [mydb1.t1.i1]; line 1 pos 7
@@ -218,7 +218,7 @@ struct<>
218218
-- !query 25
219219
SELECT mydb1.t1.i1 FROM t1
220220
-- !query 25 schema
221-
struct<>
221+
222222
-- !query 25 output
223223
org.apache.spark.sql.AnalysisException
224224
cannot resolve '`mydb1.t1.i1`' given input columns: [mydb2.t1.i1]; line 1 pos 7

sql/core/src/test/resources/sql-tests/results/csv-functions.sql.out

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ struct<from_csv(26/08/2015):struct<time:timestamp>>
2121
-- !query 2
2222
select from_csv('1', 1)
2323
-- !query 2 schema
24-
struct<>
24+
2525
-- !query 2 output
2626
org.apache.spark.sql.AnalysisException
2727
Schema should be specified in DDL format as a string literal or output of the schema_of_csv function instead of 1;; line 1 pos 7
@@ -30,7 +30,7 @@ Schema should be specified in DDL format as a string literal or output of the sc
3030
-- !query 3
3131
select from_csv('1', 'a InvalidType')
3232
-- !query 3 schema
33-
struct<>
33+
3434
-- !query 3 output
3535
org.apache.spark.sql.AnalysisException
3636

@@ -45,7 +45,7 @@ a InvalidType
4545
-- !query 4
4646
select from_csv('1', 'a INT', named_struct('mode', 'PERMISSIVE'))
4747
-- !query 4 schema
48-
struct<>
48+
4949
-- !query 4 output
5050
org.apache.spark.sql.AnalysisException
5151
Must use a map() function for options;; line 1 pos 7
@@ -54,7 +54,7 @@ Must use a map() function for options;; line 1 pos 7
5454
-- !query 5
5555
select from_csv('1', 'a INT', map('mode', 1))
5656
-- !query 5 schema
57-
struct<>
57+
5858
-- !query 5 output
5959
org.apache.spark.sql.AnalysisException
6060
A type of keys and values in map() must be string, but got map<string,int>;; line 1 pos 7
@@ -63,7 +63,7 @@ A type of keys and values in map() must be string, but got map<string,int>;; lin
6363
-- !query 6
6464
select from_csv()
6565
-- !query 6 schema
66-
struct<>
66+
6767
-- !query 6 output
6868
org.apache.spark.sql.AnalysisException
6969
Invalid number of arguments for function from_csv. Expected: one of 2 and 3; Found: 0; line 1 pos 7
@@ -88,7 +88,7 @@ struct<_c0:int,_c1:string>
8888
-- !query 9
8989
select schema_of_csv(null)
9090
-- !query 9 schema
91-
struct<>
91+
9292
-- !query 9 output
9393
org.apache.spark.sql.AnalysisException
9494
cannot resolve 'schema_of_csv(NULL)' due to data type mismatch: The input csv should be a string literal and not null; however, got NULL.; line 1 pos 7
@@ -105,7 +105,7 @@ struct<>
105105
-- !query 11
106106
SELECT schema_of_csv(csvField) FROM csvTable
107107
-- !query 11 schema
108-
struct<>
108+
109109
-- !query 11 output
110110
org.apache.spark.sql.AnalysisException
111111
cannot resolve 'schema_of_csv(csvtable.`csvField`)' due to data type mismatch: The input csv should be a string literal and not null; however, got csvtable.`csvField`.; line 1 pos 7
@@ -138,7 +138,7 @@ struct<to_csv(named_struct(time, to_timestamp('2015-08-26', 'yyyy-MM-dd'))):stri
138138
-- !query 15
139139
select to_csv(named_struct('a', 1, 'b', 2), named_struct('mode', 'PERMISSIVE'))
140140
-- !query 15 schema
141-
struct<>
141+
142142
-- !query 15 output
143143
org.apache.spark.sql.AnalysisException
144144
Must use a map() function for options;; line 1 pos 7
@@ -147,7 +147,7 @@ Must use a map() function for options;; line 1 pos 7
147147
-- !query 16
148148
select to_csv(named_struct('a', 1, 'b', 2), map('mode', 1))
149149
-- !query 16 schema
150-
struct<>
150+
151151
-- !query 16 output
152152
org.apache.spark.sql.AnalysisException
153153
A type of keys and values in map() must be string, but got map<string,int>;; line 1 pos 7

0 commit comments

Comments
 (0)