aboutsummaryrefslogblamecommitdiff
path: root/sql/core/src/test/resources/sql-tests/results/change-column.sql.out
blob: 678a3f0f0a3c64e2ba59a537bb96e788484079e6 (plain) (tree)
1
2
3
4
5
6




                                               
                                                              










                                                       
                                                                    


















                                                                                                                           
                                                                    


















                                                                                                                         
                                                                    





































                                                                                                                           
                                                                    

































                                                                    
                                                                    

















                                                                    
                                                                    


















                                                                                                                                                                       
                                                                    























                                                                                                                           
                                                                    









                                                                    
                             














                                                                 
                            















                                                                                                                          
                                                                    







































                                                                                  
                                                                                                  

































                                                                                              
-- 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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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
# col_name          	data_type           	comment             
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