aboutsummaryrefslogtreecommitdiff
path: root/sql/core/src/test/resources/sql-tests/results/change-column.sql.out
blob: ba8bc936f0c7925a626e095e149b31315d14b2db (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
-- Automatically generated by SQLQueryTestSuite
-- Number of queries: 32


-- !query 0
CREATE TABLE test_change(a INT, b STRING, c INT) using parquet
-- !query 0 schema
struct<>
-- !query 0 output



-- !query 1
DESC test_change
-- !query 1 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 1 output
a                   	int                 	                    
b                   	string              	                    
c                   	int


-- !query 2
ALTER TABLE test_change CHANGE a a1 INT
-- !query 2 schema
struct<>
-- !query 2 output
org.apache.spark.sql.AnalysisException
ALTER TABLE CHANGE COLUMN is not supported for changing column 'a' with type 'IntegerType' to 'a1' with type 'IntegerType';


-- !query 3
DESC test_change
-- !query 3 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 3 output
a                   	int                 	                    
b                   	string              	                    
c                   	int


-- !query 4
ALTER TABLE test_change CHANGE a a STRING
-- !query 4 schema
struct<>
-- !query 4 output
org.apache.spark.sql.AnalysisException
ALTER TABLE CHANGE COLUMN is not supported for changing column 'a' with type 'IntegerType' to 'a' with type 'StringType';


-- !query 5
DESC test_change
-- !query 5 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 5 output
a                   	int                 	                    
b                   	string              	                    
c                   	int


-- !query 6
ALTER TABLE test_change CHANGE a a INT AFTER b
-- !query 6 schema
struct<>
-- !query 6 output
org.apache.spark.sql.catalyst.parser.ParseException

Operation not allowed: ALTER TABLE table [PARTITION partition_spec] CHANGE COLUMN ... FIRST | AFTER otherCol(line 1, pos 0)

== SQL ==
ALTER TABLE test_change CHANGE a a INT AFTER b
^^^


-- !query 7
ALTER TABLE test_change CHANGE b b STRING FIRST
-- !query 7 schema
struct<>
-- !query 7 output
org.apache.spark.sql.catalyst.parser.ParseException

Operation not allowed: ALTER TABLE table [PARTITION partition_spec] CHANGE COLUMN ... FIRST | AFTER otherCol(line 1, pos 0)

== SQL ==
ALTER TABLE test_change CHANGE b b STRING FIRST
^^^


-- !query 8
DESC test_change
-- !query 8 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 8 output
a                   	int                 	                    
b                   	string              	                    
c                   	int


-- !query 9
ALTER TABLE test_change CHANGE a a INT COMMENT 'this is column a'
-- !query 9 schema
struct<>
-- !query 9 output



-- !query 10
ALTER TABLE test_change CHANGE b b STRING COMMENT '#*02?`'
-- !query 10 schema
struct<>
-- !query 10 output



-- !query 11
ALTER TABLE test_change CHANGE c c INT COMMENT ''
-- !query 11 schema
struct<>
-- !query 11 output



-- !query 12
DESC test_change
-- !query 12 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 12 output
a                   	int                 	this is column a    
b                   	string              	#*02?`              
c                   	int


-- !query 13
ALTER TABLE test_change CHANGE a a INT COMMENT 'this is column a'
-- !query 13 schema
struct<>
-- !query 13 output



-- !query 14
DESC test_change
-- !query 14 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 14 output
a                   	int                 	this is column a    
b                   	string              	#*02?`              
c                   	int


-- !query 15
ALTER TABLE test_change CHANGE invalid_col invalid_col INT
-- !query 15 schema
struct<>
-- !query 15 output
org.apache.spark.sql.AnalysisException
Invalid column reference 'invalid_col', table schema is 'StructType(StructField(a,IntegerType,true), StructField(b,StringType,true), StructField(c,IntegerType,true))';


-- !query 16
DESC test_change
-- !query 16 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 16 output
a                   	int                 	this is column a    
b                   	string              	#*02?`              
c                   	int


-- !query 17
ALTER TABLE test_change CHANGE a a1 STRING COMMENT 'this is column a1' AFTER b
-- !query 17 schema
struct<>
-- !query 17 output
org.apache.spark.sql.catalyst.parser.ParseException

Operation not allowed: ALTER TABLE table [PARTITION partition_spec] CHANGE COLUMN ... FIRST | AFTER otherCol(line 1, pos 0)

== SQL ==
ALTER TABLE test_change CHANGE a a1 STRING COMMENT 'this is column a1' AFTER b
^^^


-- !query 18
DESC test_change
-- !query 18 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 18 output
a                   	int                 	this is column a    
b                   	string              	#*02?`              
c                   	int


-- !query 19
SET spark.sql.caseSensitive=false
-- !query 19 schema
struct<key:string,value:string>
-- !query 19 output
spark.sql.caseSensitive	false


-- !query 20
ALTER TABLE test_change CHANGE a A INT COMMENT 'this is column A'
-- !query 20 schema
struct<>
-- !query 20 output



-- !query 21
SET spark.sql.caseSensitive=true
-- !query 21 schema
struct<key:string,value:string>
-- !query 21 output
spark.sql.caseSensitive	true


-- !query 22
ALTER TABLE test_change CHANGE a A INT COMMENT 'this is column A1'
-- !query 22 schema
struct<>
-- !query 22 output
org.apache.spark.sql.AnalysisException
ALTER TABLE CHANGE COLUMN is not supported for changing column 'a' with type 'IntegerType' to 'A' with type 'IntegerType';


-- !query 23
DESC test_change
-- !query 23 schema
struct<col_name:string,data_type:string,comment:string>
-- !query 23 output
a                   	int                 	this is column A    
b                   	string              	#*02?`              
c                   	int


-- !query 24
CREATE TEMPORARY VIEW temp_view(a, b) AS SELECT 1, "one"
-- !query 24 schema
struct<>
-- !query 24 output



-- !query 25
ALTER TABLE temp_view CHANGE a a INT COMMENT 'this is column a'
-- !query 25 schema
struct<>
-- !query 25 output
org.apache.spark.sql.catalyst.analysis.NoSuchTableException
Table or view 'temp_view' not found in database 'default';


-- !query 26
CREATE GLOBAL TEMPORARY VIEW global_temp_view(a, b) AS SELECT 1, "one"
-- !query 26 schema
struct<>
-- !query 26 output



-- !query 27
ALTER TABLE global_temp.global_temp_view CHANGE a a INT COMMENT 'this is column a'
-- !query 27 schema
struct<>
-- !query 27 output
org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException
Database 'global_temp' not found;


-- !query 28
CREATE TABLE partition_table(a INT, b STRING, c INT, d STRING) USING parquet PARTITIONED BY (c, d)
-- !query 28 schema
struct<>
-- !query 28 output



-- !query 29
ALTER TABLE partition_table PARTITION (c = 1) CHANGE COLUMN a new_a INT
-- !query 29 schema
struct<>
-- !query 29 output
org.apache.spark.sql.catalyst.parser.ParseException

Operation not allowed: ALTER TABLE table PARTITION partition_spec CHANGE COLUMN(line 1, pos 0)

== SQL ==
ALTER TABLE partition_table PARTITION (c = 1) CHANGE COLUMN a new_a INT
^^^


-- !query 30
DROP TABLE test_change
-- !query 30 schema
struct<>
-- !query 30 output



-- !query 31
DROP TABLE partition_table
-- !query 31 schema
struct<>
-- !query 31 output