Repository: spark
Updated Branches:
  refs/heads/master ef10f452e -> 6129ffa11


http://git-wip-us.apache.org/repos/asf/spark/blob/6129ffa1/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/division.sql.out
----------------------------------------------------------------------
diff --git 
a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/division.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/division.sql.out
new file mode 100644
index 0000000..017e0fe
--- /dev/null
+++ 
b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/division.sql.out
@@ -0,0 +1,1242 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 145
+
+
+-- !query 0
+CREATE TEMPORARY VIEW t AS SELECT 1
+-- !query 0 schema
+struct<>
+-- !query 0 output
+
+
+
+-- !query 1
+SELECT cast(1 as tinyint) / cast(1 as tinyint) FROM t
+-- !query 1 schema
+struct<(CAST(CAST(1 AS TINYINT) AS DOUBLE) / CAST(CAST(1 AS TINYINT) AS 
DOUBLE)):double>
+-- !query 1 output
+1.0
+
+
+-- !query 2
+SELECT cast(1 as tinyint) / cast(1 as smallint) FROM t
+-- !query 2 schema
+struct<(CAST(CAST(1 AS TINYINT) AS DOUBLE) / CAST(CAST(1 AS SMALLINT) AS 
DOUBLE)):double>
+-- !query 2 output
+1.0
+
+
+-- !query 3
+SELECT cast(1 as tinyint) / cast(1 as int) FROM t
+-- !query 3 schema
+struct<(CAST(CAST(1 AS TINYINT) AS DOUBLE) / CAST(CAST(1 AS INT) AS 
DOUBLE)):double>
+-- !query 3 output
+1.0
+
+
+-- !query 4
+SELECT cast(1 as tinyint) / cast(1 as bigint) FROM t
+-- !query 4 schema
+struct<(CAST(CAST(1 AS TINYINT) AS DOUBLE) / CAST(CAST(1 AS BIGINT) AS 
DOUBLE)):double>
+-- !query 4 output
+1.0
+
+
+-- !query 5
+SELECT cast(1 as tinyint) / cast(1 as float) FROM t
+-- !query 5 schema
+struct<(CAST(CAST(1 AS TINYINT) AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS 
DOUBLE)):double>
+-- !query 5 output
+1.0
+
+
+-- !query 6
+SELECT cast(1 as tinyint) / cast(1 as double) FROM t
+-- !query 6 schema
+struct<(CAST(CAST(1 AS TINYINT) AS DOUBLE) / CAST(CAST(1 AS DOUBLE) AS 
DOUBLE)):double>
+-- !query 6 output
+1.0
+
+
+-- !query 7
+SELECT cast(1 as tinyint) / cast(1 as decimal(10, 0)) FROM t
+-- !query 7 schema
+struct<(CAST(CAST(CAST(1 AS TINYINT) AS DECIMAL(3,0)) AS DECIMAL(10,0)) / 
CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(10,0))):decimal(14,11)>
+-- !query 7 output
+1
+
+
+-- !query 8
+SELECT cast(1 as tinyint) / cast(1 as string) FROM t
+-- !query 8 schema
+struct<(CAST(CAST(1 AS TINYINT) AS DOUBLE) / CAST(CAST(CAST(1 AS STRING) AS 
DOUBLE) AS DOUBLE)):double>
+-- !query 8 output
+1.0
+
+
+-- !query 9
+SELECT cast(1 as tinyint) / cast('1' as binary) FROM t
+-- !query 9 schema
+struct<>
+-- !query 9 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS TINYINT) / CAST('1' AS BINARY))' due to data type 
mismatch: differing types in '(CAST(1 AS TINYINT) / CAST('1' AS BINARY))' 
(tinyint and binary).; line 1 pos 7
+
+
+-- !query 10
+SELECT cast(1 as tinyint) / cast(1 as boolean) FROM t
+-- !query 10 schema
+struct<>
+-- !query 10 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS TINYINT) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: differing types in '(CAST(1 AS TINYINT) / CAST(1 AS BOOLEAN))' 
(tinyint and boolean).; line 1 pos 7
+
+
+-- !query 11
+SELECT cast(1 as tinyint) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 11 schema
+struct<>
+-- !query 11 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS TINYINT) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST(1 AS TINYINT) 
/ CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (tinyint and timestamp).; line 1 
pos 7
+
+
+-- !query 12
+SELECT cast(1 as tinyint) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 12 schema
+struct<>
+-- !query 12 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS TINYINT) / CAST('2017-12-11 09:30:00' AS DATE))' 
due to data type mismatch: differing types in '(CAST(1 AS TINYINT) / 
CAST('2017-12-11 09:30:00' AS DATE))' (tinyint and date).; line 1 pos 7
+
+
+-- !query 13
+SELECT cast(1 as smallint) / cast(1 as tinyint) FROM t
+-- !query 13 schema
+struct<(CAST(CAST(1 AS SMALLINT) AS DOUBLE) / CAST(CAST(1 AS TINYINT) AS 
DOUBLE)):double>
+-- !query 13 output
+1.0
+
+
+-- !query 14
+SELECT cast(1 as smallint) / cast(1 as smallint) FROM t
+-- !query 14 schema
+struct<(CAST(CAST(1 AS SMALLINT) AS DOUBLE) / CAST(CAST(1 AS SMALLINT) AS 
DOUBLE)):double>
+-- !query 14 output
+1.0
+
+
+-- !query 15
+SELECT cast(1 as smallint) / cast(1 as int) FROM t
+-- !query 15 schema
+struct<(CAST(CAST(1 AS SMALLINT) AS DOUBLE) / CAST(CAST(1 AS INT) AS 
DOUBLE)):double>
+-- !query 15 output
+1.0
+
+
+-- !query 16
+SELECT cast(1 as smallint) / cast(1 as bigint) FROM t
+-- !query 16 schema
+struct<(CAST(CAST(1 AS SMALLINT) AS DOUBLE) / CAST(CAST(1 AS BIGINT) AS 
DOUBLE)):double>
+-- !query 16 output
+1.0
+
+
+-- !query 17
+SELECT cast(1 as smallint) / cast(1 as float) FROM t
+-- !query 17 schema
+struct<(CAST(CAST(1 AS SMALLINT) AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS 
DOUBLE)):double>
+-- !query 17 output
+1.0
+
+
+-- !query 18
+SELECT cast(1 as smallint) / cast(1 as double) FROM t
+-- !query 18 schema
+struct<(CAST(CAST(1 AS SMALLINT) AS DOUBLE) / CAST(CAST(1 AS DOUBLE) AS 
DOUBLE)):double>
+-- !query 18 output
+1.0
+
+
+-- !query 19
+SELECT cast(1 as smallint) / cast(1 as decimal(10, 0)) FROM t
+-- !query 19 schema
+struct<(CAST(CAST(CAST(1 AS SMALLINT) AS DECIMAL(5,0)) AS DECIMAL(10,0)) / 
CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(10,0))):decimal(16,11)>
+-- !query 19 output
+1
+
+
+-- !query 20
+SELECT cast(1 as smallint) / cast(1 as string) FROM t
+-- !query 20 schema
+struct<(CAST(CAST(1 AS SMALLINT) AS DOUBLE) / CAST(CAST(CAST(1 AS STRING) AS 
DOUBLE) AS DOUBLE)):double>
+-- !query 20 output
+1.0
+
+
+-- !query 21
+SELECT cast(1 as smallint) / cast('1' as binary) FROM t
+-- !query 21 schema
+struct<>
+-- !query 21 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS SMALLINT) / CAST('1' AS BINARY))' due to data type 
mismatch: differing types in '(CAST(1 AS SMALLINT) / CAST('1' AS BINARY))' 
(smallint and binary).; line 1 pos 7
+
+
+-- !query 22
+SELECT cast(1 as smallint) / cast(1 as boolean) FROM t
+-- !query 22 schema
+struct<>
+-- !query 22 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS SMALLINT) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: differing types in '(CAST(1 AS SMALLINT) / CAST(1 AS BOOLEAN))' 
(smallint and boolean).; line 1 pos 7
+
+
+-- !query 23
+SELECT cast(1 as smallint) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 23 schema
+struct<>
+-- !query 23 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS SMALLINT) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST(1 AS 
SMALLINT) / CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (smallint and 
timestamp).; line 1 pos 7
+
+
+-- !query 24
+SELECT cast(1 as smallint) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 24 schema
+struct<>
+-- !query 24 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS SMALLINT) / CAST('2017-12-11 09:30:00' AS DATE))' 
due to data type mismatch: differing types in '(CAST(1 AS SMALLINT) / 
CAST('2017-12-11 09:30:00' AS DATE))' (smallint and date).; line 1 pos 7
+
+
+-- !query 25
+SELECT cast(1 as int) / cast(1 as tinyint) FROM t
+-- !query 25 schema
+struct<(CAST(CAST(1 AS INT) AS DOUBLE) / CAST(CAST(1 AS TINYINT) AS 
DOUBLE)):double>
+-- !query 25 output
+1.0
+
+
+-- !query 26
+SELECT cast(1 as int) / cast(1 as smallint) FROM t
+-- !query 26 schema
+struct<(CAST(CAST(1 AS INT) AS DOUBLE) / CAST(CAST(1 AS SMALLINT) AS 
DOUBLE)):double>
+-- !query 26 output
+1.0
+
+
+-- !query 27
+SELECT cast(1 as int) / cast(1 as int) FROM t
+-- !query 27 schema
+struct<(CAST(CAST(1 AS INT) AS DOUBLE) / CAST(CAST(1 AS INT) AS 
DOUBLE)):double>
+-- !query 27 output
+1.0
+
+
+-- !query 28
+SELECT cast(1 as int) / cast(1 as bigint) FROM t
+-- !query 28 schema
+struct<(CAST(CAST(1 AS INT) AS DOUBLE) / CAST(CAST(1 AS BIGINT) AS 
DOUBLE)):double>
+-- !query 28 output
+1.0
+
+
+-- !query 29
+SELECT cast(1 as int) / cast(1 as float) FROM t
+-- !query 29 schema
+struct<(CAST(CAST(1 AS INT) AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS 
DOUBLE)):double>
+-- !query 29 output
+1.0
+
+
+-- !query 30
+SELECT cast(1 as int) / cast(1 as double) FROM t
+-- !query 30 schema
+struct<(CAST(CAST(1 AS INT) AS DOUBLE) / CAST(CAST(1 AS DOUBLE) AS 
DOUBLE)):double>
+-- !query 30 output
+1.0
+
+
+-- !query 31
+SELECT cast(1 as int) / cast(1 as decimal(10, 0)) FROM t
+-- !query 31 schema
+struct<(CAST(CAST(1 AS INT) AS DECIMAL(10,0)) / CAST(1 AS 
DECIMAL(10,0))):decimal(21,11)>
+-- !query 31 output
+1
+
+
+-- !query 32
+SELECT cast(1 as int) / cast(1 as string) FROM t
+-- !query 32 schema
+struct<(CAST(CAST(1 AS INT) AS DOUBLE) / CAST(CAST(CAST(1 AS STRING) AS 
DOUBLE) AS DOUBLE)):double>
+-- !query 32 output
+1.0
+
+
+-- !query 33
+SELECT cast(1 as int) / cast('1' as binary) FROM t
+-- !query 33 schema
+struct<>
+-- !query 33 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS INT) / CAST('1' AS BINARY))' due to data type 
mismatch: differing types in '(CAST(1 AS INT) / CAST('1' AS BINARY))' (int and 
binary).; line 1 pos 7
+
+
+-- !query 34
+SELECT cast(1 as int) / cast(1 as boolean) FROM t
+-- !query 34 schema
+struct<>
+-- !query 34 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS INT) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: differing types in '(CAST(1 AS INT) / CAST(1 AS BOOLEAN))' (int and 
boolean).; line 1 pos 7
+
+
+-- !query 35
+SELECT cast(1 as int) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 35 schema
+struct<>
+-- !query 35 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS INT) / CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' 
due to data type mismatch: differing types in '(CAST(1 AS INT) / 
CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (int and timestamp).; line 1 pos 7
+
+
+-- !query 36
+SELECT cast(1 as int) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 36 schema
+struct<>
+-- !query 36 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS INT) / CAST('2017-12-11 09:30:00' AS DATE))' due to 
data type mismatch: differing types in '(CAST(1 AS INT) / CAST('2017-12-11 
09:30:00' AS DATE))' (int and date).; line 1 pos 7
+
+
+-- !query 37
+SELECT cast(1 as bigint) / cast(1 as tinyint) FROM t
+-- !query 37 schema
+struct<(CAST(CAST(1 AS BIGINT) AS DOUBLE) / CAST(CAST(1 AS TINYINT) AS 
DOUBLE)):double>
+-- !query 37 output
+1.0
+
+
+-- !query 38
+SELECT cast(1 as bigint) / cast(1 as smallint) FROM t
+-- !query 38 schema
+struct<(CAST(CAST(1 AS BIGINT) AS DOUBLE) / CAST(CAST(1 AS SMALLINT) AS 
DOUBLE)):double>
+-- !query 38 output
+1.0
+
+
+-- !query 39
+SELECT cast(1 as bigint) / cast(1 as int) FROM t
+-- !query 39 schema
+struct<(CAST(CAST(1 AS BIGINT) AS DOUBLE) / CAST(CAST(1 AS INT) AS 
DOUBLE)):double>
+-- !query 39 output
+1.0
+
+
+-- !query 40
+SELECT cast(1 as bigint) / cast(1 as bigint) FROM t
+-- !query 40 schema
+struct<(CAST(CAST(1 AS BIGINT) AS DOUBLE) / CAST(CAST(1 AS BIGINT) AS 
DOUBLE)):double>
+-- !query 40 output
+1.0
+
+
+-- !query 41
+SELECT cast(1 as bigint) / cast(1 as float) FROM t
+-- !query 41 schema
+struct<(CAST(CAST(1 AS BIGINT) AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS 
DOUBLE)):double>
+-- !query 41 output
+1.0
+
+
+-- !query 42
+SELECT cast(1 as bigint) / cast(1 as double) FROM t
+-- !query 42 schema
+struct<(CAST(CAST(1 AS BIGINT) AS DOUBLE) / CAST(CAST(1 AS DOUBLE) AS 
DOUBLE)):double>
+-- !query 42 output
+1.0
+
+
+-- !query 43
+SELECT cast(1 as bigint) / cast(1 as decimal(10, 0)) FROM t
+-- !query 43 schema
+struct<(CAST(CAST(CAST(1 AS BIGINT) AS DECIMAL(20,0)) AS DECIMAL(20,0)) / 
CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(20,0))):decimal(31,11)>
+-- !query 43 output
+1
+
+
+-- !query 44
+SELECT cast(1 as bigint) / cast(1 as string) FROM t
+-- !query 44 schema
+struct<(CAST(CAST(1 AS BIGINT) AS DOUBLE) / CAST(CAST(CAST(1 AS STRING) AS 
DOUBLE) AS DOUBLE)):double>
+-- !query 44 output
+1.0
+
+
+-- !query 45
+SELECT cast(1 as bigint) / cast('1' as binary) FROM t
+-- !query 45 schema
+struct<>
+-- !query 45 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BIGINT) / CAST('1' AS BINARY))' due to data type 
mismatch: differing types in '(CAST(1 AS BIGINT) / CAST('1' AS BINARY))' 
(bigint and binary).; line 1 pos 7
+
+
+-- !query 46
+SELECT cast(1 as bigint) / cast(1 as boolean) FROM t
+-- !query 46 schema
+struct<>
+-- !query 46 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BIGINT) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: differing types in '(CAST(1 AS BIGINT) / CAST(1 AS BOOLEAN))' (bigint 
and boolean).; line 1 pos 7
+
+
+-- !query 47
+SELECT cast(1 as bigint) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 47 schema
+struct<>
+-- !query 47 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BIGINT) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST(1 AS BIGINT) 
/ CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (bigint and timestamp).; line 1 
pos 7
+
+
+-- !query 48
+SELECT cast(1 as bigint) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 48 schema
+struct<>
+-- !query 48 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BIGINT) / CAST('2017-12-11 09:30:00' AS DATE))' due 
to data type mismatch: differing types in '(CAST(1 AS BIGINT) / 
CAST('2017-12-11 09:30:00' AS DATE))' (bigint and date).; line 1 pos 7
+
+
+-- !query 49
+SELECT cast(1 as float) / cast(1 as tinyint) FROM t
+-- !query 49 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(1 AS TINYINT) AS 
DOUBLE)):double>
+-- !query 49 output
+1.0
+
+
+-- !query 50
+SELECT cast(1 as float) / cast(1 as smallint) FROM t
+-- !query 50 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(1 AS SMALLINT) AS 
DOUBLE)):double>
+-- !query 50 output
+1.0
+
+
+-- !query 51
+SELECT cast(1 as float) / cast(1 as int) FROM t
+-- !query 51 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(1 AS INT) AS 
DOUBLE)):double>
+-- !query 51 output
+1.0
+
+
+-- !query 52
+SELECT cast(1 as float) / cast(1 as bigint) FROM t
+-- !query 52 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(1 AS BIGINT) AS 
DOUBLE)):double>
+-- !query 52 output
+1.0
+
+
+-- !query 53
+SELECT cast(1 as float) / cast(1 as float) FROM t
+-- !query 53 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS 
DOUBLE)):double>
+-- !query 53 output
+1.0
+
+
+-- !query 54
+SELECT cast(1 as float) / cast(1 as double) FROM t
+-- !query 54 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(1 AS DOUBLE) AS 
DOUBLE)):double>
+-- !query 54 output
+1.0
+
+
+-- !query 55
+SELECT cast(1 as float) / cast(1 as decimal(10, 0)) FROM t
+-- !query 55 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(CAST(1 AS DECIMAL(10,0)) 
AS DOUBLE) AS DOUBLE)):double>
+-- !query 55 output
+1.0
+
+
+-- !query 56
+SELECT cast(1 as float) / cast(1 as string) FROM t
+-- !query 56 schema
+struct<(CAST(CAST(1 AS FLOAT) AS DOUBLE) / CAST(CAST(CAST(1 AS STRING) AS 
DOUBLE) AS DOUBLE)):double>
+-- !query 56 output
+1.0
+
+
+-- !query 57
+SELECT cast(1 as float) / cast('1' as binary) FROM t
+-- !query 57 schema
+struct<>
+-- !query 57 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS FLOAT) / CAST('1' AS BINARY))' due to data type 
mismatch: differing types in '(CAST(1 AS FLOAT) / CAST('1' AS BINARY))' (float 
and binary).; line 1 pos 7
+
+
+-- !query 58
+SELECT cast(1 as float) / cast(1 as boolean) FROM t
+-- !query 58 schema
+struct<>
+-- !query 58 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS FLOAT) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: differing types in '(CAST(1 AS FLOAT) / CAST(1 AS BOOLEAN))' (float 
and boolean).; line 1 pos 7
+
+
+-- !query 59
+SELECT cast(1 as float) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 59 schema
+struct<>
+-- !query 59 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS FLOAT) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST(1 AS FLOAT) / 
CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (float and timestamp).; line 1 pos 
7
+
+
+-- !query 60
+SELECT cast(1 as float) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 60 schema
+struct<>
+-- !query 60 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS FLOAT) / CAST('2017-12-11 09:30:00' AS DATE))' due 
to data type mismatch: differing types in '(CAST(1 AS FLOAT) / CAST('2017-12-11 
09:30:00' AS DATE))' (float and date).; line 1 pos 7
+
+
+-- !query 61
+SELECT cast(1 as double) / cast(1 as tinyint) FROM t
+-- !query 61 schema
+struct<(CAST(1 AS DOUBLE) / CAST(CAST(1 AS TINYINT) AS DOUBLE)):double>
+-- !query 61 output
+1.0
+
+
+-- !query 62
+SELECT cast(1 as double) / cast(1 as smallint) FROM t
+-- !query 62 schema
+struct<(CAST(1 AS DOUBLE) / CAST(CAST(1 AS SMALLINT) AS DOUBLE)):double>
+-- !query 62 output
+1.0
+
+
+-- !query 63
+SELECT cast(1 as double) / cast(1 as int) FROM t
+-- !query 63 schema
+struct<(CAST(1 AS DOUBLE) / CAST(CAST(1 AS INT) AS DOUBLE)):double>
+-- !query 63 output
+1.0
+
+
+-- !query 64
+SELECT cast(1 as double) / cast(1 as bigint) FROM t
+-- !query 64 schema
+struct<(CAST(1 AS DOUBLE) / CAST(CAST(1 AS BIGINT) AS DOUBLE)):double>
+-- !query 64 output
+1.0
+
+
+-- !query 65
+SELECT cast(1 as double) / cast(1 as float) FROM t
+-- !query 65 schema
+struct<(CAST(1 AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS DOUBLE)):double>
+-- !query 65 output
+1.0
+
+
+-- !query 66
+SELECT cast(1 as double) / cast(1 as double) FROM t
+-- !query 66 schema
+struct<(CAST(1 AS DOUBLE) / CAST(1 AS DOUBLE)):double>
+-- !query 66 output
+1.0
+
+
+-- !query 67
+SELECT cast(1 as double) / cast(1 as decimal(10, 0)) FROM t
+-- !query 67 schema
+struct<(CAST(1 AS DOUBLE) / CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE)):double>
+-- !query 67 output
+1.0
+
+
+-- !query 68
+SELECT cast(1 as double) / cast(1 as string) FROM t
+-- !query 68 schema
+struct<(CAST(1 AS DOUBLE) / CAST(CAST(1 AS STRING) AS DOUBLE)):double>
+-- !query 68 output
+1.0
+
+
+-- !query 69
+SELECT cast(1 as double) / cast('1' as binary) FROM t
+-- !query 69 schema
+struct<>
+-- !query 69 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DOUBLE) / CAST('1' AS BINARY))' due to data type 
mismatch: differing types in '(CAST(1 AS DOUBLE) / CAST('1' AS BINARY))' 
(double and binary).; line 1 pos 7
+
+
+-- !query 70
+SELECT cast(1 as double) / cast(1 as boolean) FROM t
+-- !query 70 schema
+struct<>
+-- !query 70 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DOUBLE) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: differing types in '(CAST(1 AS DOUBLE) / CAST(1 AS BOOLEAN))' (double 
and boolean).; line 1 pos 7
+
+
+-- !query 71
+SELECT cast(1 as double) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 71 schema
+struct<>
+-- !query 71 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DOUBLE) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST(1 AS DOUBLE) 
/ CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (double and timestamp).; line 1 
pos 7
+
+
+-- !query 72
+SELECT cast(1 as double) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 72 schema
+struct<>
+-- !query 72 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DOUBLE) / CAST('2017-12-11 09:30:00' AS DATE))' due 
to data type mismatch: differing types in '(CAST(1 AS DOUBLE) / 
CAST('2017-12-11 09:30:00' AS DATE))' (double and date).; line 1 pos 7
+
+
+-- !query 73
+SELECT cast(1 as decimal(10, 0)) / cast(1 as tinyint) FROM t
+-- !query 73 schema
+struct<(CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(10,0)) / CAST(CAST(CAST(1 AS 
TINYINT) AS DECIMAL(3,0)) AS DECIMAL(10,0))):decimal(16,6)>
+-- !query 73 output
+1
+
+
+-- !query 74
+SELECT cast(1 as decimal(10, 0)) / cast(1 as smallint) FROM t
+-- !query 74 schema
+struct<(CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(10,0)) / CAST(CAST(CAST(1 AS 
SMALLINT) AS DECIMAL(5,0)) AS DECIMAL(10,0))):decimal(16,6)>
+-- !query 74 output
+1
+
+
+-- !query 75
+SELECT cast(1 as decimal(10, 0)) / cast(1 as int) FROM t
+-- !query 75 schema
+struct<(CAST(1 AS DECIMAL(10,0)) / CAST(CAST(1 AS INT) AS 
DECIMAL(10,0))):decimal(21,11)>
+-- !query 75 output
+1
+
+
+-- !query 76
+SELECT cast(1 as decimal(10, 0)) / cast(1 as bigint) FROM t
+-- !query 76 schema
+struct<(CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(20,0)) / CAST(CAST(CAST(1 AS 
BIGINT) AS DECIMAL(20,0)) AS DECIMAL(20,0))):decimal(31,21)>
+-- !query 76 output
+1
+
+
+-- !query 77
+SELECT cast(1 as decimal(10, 0)) / cast(1 as float) FROM t
+-- !query 77 schema
+struct<(CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS 
DOUBLE)):double>
+-- !query 77 output
+1.0
+
+
+-- !query 78
+SELECT cast(1 as decimal(10, 0)) / cast(1 as double) FROM t
+-- !query 78 schema
+struct<(CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE) / CAST(1 AS DOUBLE)):double>
+-- !query 78 output
+1.0
+
+
+-- !query 79
+SELECT cast(1 as decimal(10, 0)) / cast(1 as decimal(10, 0)) FROM t
+-- !query 79 schema
+struct<(CAST(1 AS DECIMAL(10,0)) / CAST(1 AS DECIMAL(10,0))):decimal(21,11)>
+-- !query 79 output
+1
+
+
+-- !query 80
+SELECT cast(1 as decimal(10, 0)) / cast(1 as string) FROM t
+-- !query 80 schema
+struct<(CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE) / CAST(CAST(1 AS STRING) AS 
DOUBLE)):double>
+-- !query 80 output
+1.0
+
+
+-- !query 81
+SELECT cast(1 as decimal(10, 0)) / cast('1' as binary) FROM t
+-- !query 81 schema
+struct<>
+-- !query 81 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DECIMAL(10,0)) / CAST('1' AS BINARY))' due to data 
type mismatch: differing types in '(CAST(1 AS DECIMAL(10,0)) / CAST('1' AS 
BINARY))' (decimal(10,0) and binary).; line 1 pos 7
+
+
+-- !query 82
+SELECT cast(1 as decimal(10, 0)) / cast(1 as boolean) FROM t
+-- !query 82 schema
+struct<>
+-- !query 82 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DECIMAL(10,0)) / CAST(1 AS BOOLEAN))' due to data 
type mismatch: differing types in '(CAST(1 AS DECIMAL(10,0)) / CAST(1 AS 
BOOLEAN))' (decimal(10,0) and boolean).; line 1 pos 7
+
+
+-- !query 83
+SELECT cast(1 as decimal(10, 0)) / cast('2017-12-11 09:30:00.0' as timestamp) 
FROM t
+-- !query 83 schema
+struct<>
+-- !query 83 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DECIMAL(10,0)) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST(1 AS 
DECIMAL(10,0)) / CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (decimal(10,0) 
and timestamp).; line 1 pos 7
+
+
+-- !query 84
+SELECT cast(1 as decimal(10, 0)) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 84 schema
+struct<>
+-- !query 84 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS DECIMAL(10,0)) / CAST('2017-12-11 09:30:00' AS 
DATE))' due to data type mismatch: differing types in '(CAST(1 AS 
DECIMAL(10,0)) / CAST('2017-12-11 09:30:00' AS DATE))' (decimal(10,0) and 
date).; line 1 pos 7
+
+
+-- !query 85
+SELECT cast(1 as string) / cast(1 as tinyint) FROM t
+-- !query 85 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(CAST(1 AS TINYINT) AS 
DOUBLE)):double>
+-- !query 85 output
+1.0
+
+
+-- !query 86
+SELECT cast(1 as string) / cast(1 as smallint) FROM t
+-- !query 86 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(CAST(1 AS SMALLINT) AS 
DOUBLE)):double>
+-- !query 86 output
+1.0
+
+
+-- !query 87
+SELECT cast(1 as string) / cast(1 as int) FROM t
+-- !query 87 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(CAST(1 AS INT) AS 
DOUBLE)):double>
+-- !query 87 output
+1.0
+
+
+-- !query 88
+SELECT cast(1 as string) / cast(1 as bigint) FROM t
+-- !query 88 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(CAST(1 AS BIGINT) AS 
DOUBLE)):double>
+-- !query 88 output
+1.0
+
+
+-- !query 89
+SELECT cast(1 as string) / cast(1 as float) FROM t
+-- !query 89 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(CAST(1 AS FLOAT) AS 
DOUBLE)):double>
+-- !query 89 output
+1.0
+
+
+-- !query 90
+SELECT cast(1 as string) / cast(1 as double) FROM t
+-- !query 90 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(1 AS DOUBLE)):double>
+-- !query 90 output
+1.0
+
+
+-- !query 91
+SELECT cast(1 as string) / cast(1 as decimal(10, 0)) FROM t
+-- !query 91 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(CAST(1 AS DECIMAL(10,0)) AS 
DOUBLE)):double>
+-- !query 91 output
+1.0
+
+
+-- !query 92
+SELECT cast(1 as string) / cast(1 as string) FROM t
+-- !query 92 schema
+struct<(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(CAST(1 AS STRING) AS 
DOUBLE)):double>
+-- !query 92 output
+1.0
+
+
+-- !query 93
+SELECT cast(1 as string) / cast('1' as binary) FROM t
+-- !query 93 schema
+struct<>
+-- !query 93 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST('1' AS BINARY))' due 
to data type mismatch: differing types in '(CAST(CAST(1 AS STRING) AS DOUBLE) / 
CAST('1' AS BINARY))' (double and binary).; line 1 pos 7
+
+
+-- !query 94
+SELECT cast(1 as string) / cast(1 as boolean) FROM t
+-- !query 94 schema
+struct<>
+-- !query 94 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST(1 AS BOOLEAN))' due 
to data type mismatch: differing types in '(CAST(CAST(1 AS STRING) AS DOUBLE) / 
CAST(1 AS BOOLEAN))' (double and boolean).; line 1 pos 7
+
+
+-- !query 95
+SELECT cast(1 as string) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 95 schema
+struct<>
+-- !query 95 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP))' due to data type mismatch: differing types in 
'(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' (double and timestamp).; line 1 pos 7
+
+
+-- !query 96
+SELECT cast(1 as string) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 96 schema
+struct<>
+-- !query 96 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST('2017-12-11 
09:30:00' AS DATE))' due to data type mismatch: differing types in 
'(CAST(CAST(1 AS STRING) AS DOUBLE) / CAST('2017-12-11 09:30:00' AS DATE))' 
(double and date).; line 1 pos 7
+
+
+-- !query 97
+SELECT cast('1' as binary) / cast(1 as tinyint) FROM t
+-- !query 97 schema
+struct<>
+-- !query 97 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS TINYINT))' due to data type 
mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS TINYINT))' 
(binary and tinyint).; line 1 pos 7
+
+
+-- !query 98
+SELECT cast('1' as binary) / cast(1 as smallint) FROM t
+-- !query 98 schema
+struct<>
+-- !query 98 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS SMALLINT))' due to data type 
mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS SMALLINT))' 
(binary and smallint).; line 1 pos 7
+
+
+-- !query 99
+SELECT cast('1' as binary) / cast(1 as int) FROM t
+-- !query 99 schema
+struct<>
+-- !query 99 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS INT))' due to data type 
mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS INT))' (binary 
and int).; line 1 pos 7
+
+
+-- !query 100
+SELECT cast('1' as binary) / cast(1 as bigint) FROM t
+-- !query 100 schema
+struct<>
+-- !query 100 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS BIGINT))' due to data type 
mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS BIGINT))' 
(binary and bigint).; line 1 pos 7
+
+
+-- !query 101
+SELECT cast('1' as binary) / cast(1 as float) FROM t
+-- !query 101 schema
+struct<>
+-- !query 101 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS FLOAT))' due to data type 
mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS FLOAT))' (binary 
and float).; line 1 pos 7
+
+
+-- !query 102
+SELECT cast('1' as binary) / cast(1 as double) FROM t
+-- !query 102 schema
+struct<>
+-- !query 102 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS DOUBLE))' due to data type 
mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS DOUBLE))' 
(binary and double).; line 1 pos 7
+
+
+-- !query 103
+SELECT cast('1' as binary) / cast(1 as decimal(10, 0)) FROM t
+-- !query 103 schema
+struct<>
+-- !query 103 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS DECIMAL(10,0)))' due to data 
type mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS 
DECIMAL(10,0)))' (binary and decimal(10,0)).; line 1 pos 7
+
+
+-- !query 104
+SELECT cast('1' as binary) / cast(1 as string) FROM t
+-- !query 104 schema
+struct<>
+-- !query 104 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(CAST(1 AS STRING) AS DOUBLE))' due 
to data type mismatch: differing types in '(CAST('1' AS BINARY) / CAST(CAST(1 
AS STRING) AS DOUBLE))' (binary and double).; line 1 pos 7
+
+
+-- !query 105
+SELECT cast('1' as binary) / cast('1' as binary) FROM t
+-- !query 105 schema
+struct<>
+-- !query 105 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST('1' AS BINARY))' due to data type 
mismatch: '(CAST('1' AS BINARY) / CAST('1' AS BINARY))' requires (double or 
decimal) type, not binary; line 1 pos 7
+
+
+-- !query 106
+SELECT cast('1' as binary) / cast(1 as boolean) FROM t
+-- !query 106 schema
+struct<>
+-- !query 106 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: differing types in '(CAST('1' AS BINARY) / CAST(1 AS BOOLEAN))' 
(binary and boolean).; line 1 pos 7
+
+
+-- !query 107
+SELECT cast('1' as binary) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 107 schema
+struct<>
+-- !query 107 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST('1' AS 
BINARY) / CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (binary and timestamp).; 
line 1 pos 7
+
+
+-- !query 108
+SELECT cast('1' as binary) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 108 schema
+struct<>
+-- !query 108 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('1' AS BINARY) / CAST('2017-12-11 09:30:00' AS DATE))' 
due to data type mismatch: differing types in '(CAST('1' AS BINARY) / 
CAST('2017-12-11 09:30:00' AS DATE))' (binary and date).; line 1 pos 7
+
+
+-- !query 109
+SELECT cast(1 as boolean) / cast(1 as tinyint) FROM t
+-- !query 109 schema
+struct<>
+-- !query 109 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS TINYINT))' due to data type 
mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(1 AS TINYINT))' 
(boolean and tinyint).; line 1 pos 7
+
+
+-- !query 110
+SELECT cast(1 as boolean) / cast(1 as smallint) FROM t
+-- !query 110 schema
+struct<>
+-- !query 110 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS SMALLINT))' due to data type 
mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(1 AS SMALLINT))' 
(boolean and smallint).; line 1 pos 7
+
+
+-- !query 111
+SELECT cast(1 as boolean) / cast(1 as int) FROM t
+-- !query 111 schema
+struct<>
+-- !query 111 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS INT))' due to data type 
mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(1 AS INT))' (boolean 
and int).; line 1 pos 7
+
+
+-- !query 112
+SELECT cast(1 as boolean) / cast(1 as bigint) FROM t
+-- !query 112 schema
+struct<>
+-- !query 112 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS BIGINT))' due to data type 
mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(1 AS BIGINT))' 
(boolean and bigint).; line 1 pos 7
+
+
+-- !query 113
+SELECT cast(1 as boolean) / cast(1 as float) FROM t
+-- !query 113 schema
+struct<>
+-- !query 113 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS FLOAT))' due to data type 
mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(1 AS FLOAT))' (boolean 
and float).; line 1 pos 7
+
+
+-- !query 114
+SELECT cast(1 as boolean) / cast(1 as double) FROM t
+-- !query 114 schema
+struct<>
+-- !query 114 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS DOUBLE))' due to data type 
mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(1 AS DOUBLE))' 
(boolean and double).; line 1 pos 7
+
+
+-- !query 115
+SELECT cast(1 as boolean) / cast(1 as decimal(10, 0)) FROM t
+-- !query 115 schema
+struct<>
+-- !query 115 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS DECIMAL(10,0)))' due to data 
type mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(1 AS 
DECIMAL(10,0)))' (boolean and decimal(10,0)).; line 1 pos 7
+
+
+-- !query 116
+SELECT cast(1 as boolean) / cast(1 as string) FROM t
+-- !query 116 schema
+struct<>
+-- !query 116 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(CAST(1 AS STRING) AS DOUBLE))' due 
to data type mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST(CAST(1 AS 
STRING) AS DOUBLE))' (boolean and double).; line 1 pos 7
+
+
+-- !query 117
+SELECT cast(1 as boolean) / cast('1' as binary) FROM t
+-- !query 117 schema
+struct<>
+-- !query 117 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST('1' AS BINARY))' due to data type 
mismatch: differing types in '(CAST(1 AS BOOLEAN) / CAST('1' AS BINARY))' 
(boolean and binary).; line 1 pos 7
+
+
+-- !query 118
+SELECT cast(1 as boolean) / cast(1 as boolean) FROM t
+-- !query 118 schema
+struct<>
+-- !query 118 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST(1 AS BOOLEAN))' due to data type 
mismatch: '(CAST(1 AS BOOLEAN) / CAST(1 AS BOOLEAN))' requires (double or 
decimal) type, not boolean; line 1 pos 7
+
+
+-- !query 119
+SELECT cast(1 as boolean) / cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 119 schema
+struct<>
+-- !query 119 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' due to data type mismatch: differing types in '(CAST(1 AS BOOLEAN) 
/ CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' (boolean and timestamp).; line 1 
pos 7
+
+
+-- !query 120
+SELECT cast(1 as boolean) / cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 120 schema
+struct<>
+-- !query 120 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST(1 AS BOOLEAN) / CAST('2017-12-11 09:30:00' AS DATE))' 
due to data type mismatch: differing types in '(CAST(1 AS BOOLEAN) / 
CAST('2017-12-11 09:30:00' AS DATE))' (boolean and date).; line 1 pos 7
+
+
+-- !query 121
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as tinyint) FROM t
+-- !query 121 schema
+struct<>
+-- !query 121 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS 
TINYINT))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST(1 AS TINYINT))' (timestamp and tinyint).; line 
1 pos 7
+
+
+-- !query 122
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as smallint) FROM t
+-- !query 122 schema
+struct<>
+-- !query 122 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS 
SMALLINT))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST(1 AS SMALLINT))' (timestamp and smallint).; 
line 1 pos 7
+
+
+-- !query 123
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as int) FROM t
+-- !query 123 schema
+struct<>
+-- !query 123 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS INT))' 
due to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP) / CAST(1 AS INT))' (timestamp and int).; line 1 pos 7
+
+
+-- !query 124
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as bigint) FROM t
+-- !query 124 schema
+struct<>
+-- !query 124 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS 
BIGINT))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST(1 AS BIGINT))' (timestamp and bigint).; line 1 
pos 7
+
+
+-- !query 125
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as float) FROM t
+-- !query 125 schema
+struct<>
+-- !query 125 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS 
FLOAT))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST(1 AS FLOAT))' (timestamp and float).; line 1 
pos 7
+
+
+-- !query 126
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as double) FROM t
+-- !query 126 schema
+struct<>
+-- !query 126 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS 
DOUBLE))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST(1 AS DOUBLE))' (timestamp and double).; line 1 
pos 7
+
+
+-- !query 127
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as decimal(10, 0)) 
FROM t
+-- !query 127 schema
+struct<>
+-- !query 127 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS 
DECIMAL(10,0)))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS DECIMAL(10,0)))' 
(timestamp and decimal(10,0)).; line 1 pos 7
+
+
+-- !query 128
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as string) FROM t
+-- !query 128 schema
+struct<>
+-- !query 128 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(CAST(1 AS 
STRING) AS DOUBLE))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(CAST(1 AS STRING) AS 
DOUBLE))' (timestamp and double).; line 1 pos 7
+
+
+-- !query 129
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast('1' as binary) FROM t
+-- !query 129 schema
+struct<>
+-- !query 129 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST('1' AS 
BINARY))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST('1' AS BINARY))' (timestamp and binary).; line 
1 pos 7
+
+
+-- !query 130
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast(1 as boolean) FROM t
+-- !query 130 schema
+struct<>
+-- !query 130 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST(1 AS 
BOOLEAN))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST(1 AS BOOLEAN))' (timestamp and boolean).; line 
1 pos 7
+
+
+-- !query 131
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast('2017-12-11 
09:30:00.0' as timestamp) FROM t
+-- !query 131 schema
+struct<>
+-- !query 131 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP))' due to data type mismatch: '(CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP) / CAST('2017-12-11 09:30:00.0' AS TIMESTAMP))' 
requires (double or decimal) type, not timestamp; line 1 pos 7
+
+
+-- !query 132
+SELECT cast('2017-12-11 09:30:00.0' as timestamp) / cast('2017-12-11 09:30:00' 
as date) FROM t
+-- !query 132 schema
+struct<>
+-- !query 132 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST('2017-12-11 
09:30:00' AS DATE))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) / CAST('2017-12-11 09:30:00' AS 
DATE))' (timestamp and date).; line 1 pos 7
+
+
+-- !query 133
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as tinyint) FROM t
+-- !query 133 schema
+struct<>
+-- !query 133 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS TINYINT))' 
due to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS 
DATE) / CAST(1 AS TINYINT))' (date and tinyint).; line 1 pos 7
+
+
+-- !query 134
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as smallint) FROM t
+-- !query 134 schema
+struct<>
+-- !query 134 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS SMALLINT))' 
due to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS 
DATE) / CAST(1 AS SMALLINT))' (date and smallint).; line 1 pos 7
+
+
+-- !query 135
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as int) FROM t
+-- !query 135 schema
+struct<>
+-- !query 135 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS INT))' due to 
data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS DATE) / 
CAST(1 AS INT))' (date and int).; line 1 pos 7
+
+
+-- !query 136
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as bigint) FROM t
+-- !query 136 schema
+struct<>
+-- !query 136 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS BIGINT))' due 
to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS DATE) 
/ CAST(1 AS BIGINT))' (date and bigint).; line 1 pos 7
+
+
+-- !query 137
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as float) FROM t
+-- !query 137 schema
+struct<>
+-- !query 137 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS FLOAT))' due 
to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS DATE) 
/ CAST(1 AS FLOAT))' (date and float).; line 1 pos 7
+
+
+-- !query 138
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as double) FROM t
+-- !query 138 schema
+struct<>
+-- !query 138 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS DOUBLE))' due 
to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS DATE) 
/ CAST(1 AS DOUBLE))' (date and double).; line 1 pos 7
+
+
+-- !query 139
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as decimal(10, 0)) FROM t
+-- !query 139 schema
+struct<>
+-- !query 139 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS 
DECIMAL(10,0)))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS DECIMAL(10,0)))' (date and 
decimal(10,0)).; line 1 pos 7
+
+
+-- !query 140
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as string) FROM t
+-- !query 140 schema
+struct<>
+-- !query 140 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(CAST(1 AS STRING) 
AS DOUBLE))' due to data type mismatch: differing types in '(CAST('2017-12-11 
09:30:00' AS DATE) / CAST(CAST(1 AS STRING) AS DOUBLE))' (date and double).; 
line 1 pos 7
+
+
+-- !query 141
+SELECT cast('2017-12-11 09:30:00' as date) / cast('1' as binary) FROM t
+-- !query 141 schema
+struct<>
+-- !query 141 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST('1' AS BINARY))' 
due to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS 
DATE) / CAST('1' AS BINARY))' (date and binary).; line 1 pos 7
+
+
+-- !query 142
+SELECT cast('2017-12-11 09:30:00' as date) / cast(1 as boolean) FROM t
+-- !query 142 schema
+struct<>
+-- !query 142 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST(1 AS BOOLEAN))' 
due to data type mismatch: differing types in '(CAST('2017-12-11 09:30:00' AS 
DATE) / CAST(1 AS BOOLEAN))' (date and boolean).; line 1 pos 7
+
+
+-- !query 143
+SELECT cast('2017-12-11 09:30:00' as date) / cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 143 schema
+struct<>
+-- !query 143 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST('2017-12-11 
09:30:00.0' AS TIMESTAMP))' due to data type mismatch: differing types in 
'(CAST('2017-12-11 09:30:00' AS DATE) / CAST('2017-12-11 09:30:00.0' AS 
TIMESTAMP))' (date and timestamp).; line 1 pos 7
+
+
+-- !query 144
+SELECT cast('2017-12-11 09:30:00' as date) / cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 144 schema
+struct<>
+-- !query 144 output
+org.apache.spark.sql.AnalysisException
+cannot resolve '(CAST('2017-12-11 09:30:00' AS DATE) / CAST('2017-12-11 
09:30:00' AS DATE))' due to data type mismatch: '(CAST('2017-12-11 09:30:00' AS 
DATE) / CAST('2017-12-11 09:30:00' AS DATE))' requires (double or decimal) 
type, not date; line 1 pos 7

http://git-wip-us.apache.org/repos/asf/spark/blob/6129ffa1/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/widenSetOperationTypes.sql.out
----------------------------------------------------------------------
diff --git 
a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/widenSetOperationTypes.sql.out
 
b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/widenSetOperationTypes.sql.out
new file mode 100644
index 0000000..20a9e47
--- /dev/null
+++ 
b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/widenSetOperationTypes.sql.out
@@ -0,0 +1,1305 @@
+-- Automatically generated by SQLQueryTestSuite
+-- Number of queries: 145
+
+
+-- !query 0
+CREATE TEMPORARY VIEW t AS SELECT 1
+-- !query 0 schema
+struct<>
+-- !query 0 output
+
+
+
+-- !query 1
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 1 schema
+struct<CAST(1 AS TINYINT):tinyint>
+-- !query 1 output
+1
+2
+
+
+-- !query 2
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 2 schema
+struct<CAST(1 AS TINYINT):smallint>
+-- !query 2 output
+1
+2
+
+
+-- !query 3
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 3 schema
+struct<CAST(1 AS TINYINT):int>
+-- !query 3 output
+1
+2
+
+
+-- !query 4
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 4 schema
+struct<CAST(1 AS TINYINT):bigint>
+-- !query 4 output
+1
+2
+
+
+-- !query 5
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 5 schema
+struct<CAST(1 AS TINYINT):float>
+-- !query 5 output
+1.0
+2.0
+
+
+-- !query 6
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 6 schema
+struct<CAST(1 AS TINYINT):double>
+-- !query 6 output
+1.0
+2.0
+
+
+-- !query 7
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 7 schema
+struct<CAST(1 AS TINYINT):decimal(10,0)>
+-- !query 7 output
+1
+2
+
+
+-- !query 8
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 8 schema
+struct<CAST(1 AS TINYINT):string>
+-- !query 8 output
+1
+2
+
+
+-- !query 9
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 9 schema
+struct<>
+-- !query 9 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> tinyint at the first column of the second table;
+
+
+-- !query 10
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 10 schema
+struct<>
+-- !query 10 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> tinyint at the first column of the second table;
+
+
+-- !query 11
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 11 schema
+struct<>
+-- !query 11 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> tinyint at the first column of the second table;
+
+
+-- !query 12
+SELECT cast(1 as tinyint) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 12 schema
+struct<>
+-- !query 12 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> tinyint at the first column of the second table;
+
+
+-- !query 13
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 13 schema
+struct<CAST(1 AS SMALLINT):smallint>
+-- !query 13 output
+1
+2
+
+
+-- !query 14
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 14 schema
+struct<CAST(1 AS SMALLINT):smallint>
+-- !query 14 output
+1
+2
+
+
+-- !query 15
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 15 schema
+struct<CAST(1 AS SMALLINT):int>
+-- !query 15 output
+1
+2
+
+
+-- !query 16
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 16 schema
+struct<CAST(1 AS SMALLINT):bigint>
+-- !query 16 output
+1
+2
+
+
+-- !query 17
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 17 schema
+struct<CAST(1 AS SMALLINT):float>
+-- !query 17 output
+1.0
+2.0
+
+
+-- !query 18
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 18 schema
+struct<CAST(1 AS SMALLINT):double>
+-- !query 18 output
+1.0
+2.0
+
+
+-- !query 19
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 19 schema
+struct<CAST(1 AS SMALLINT):decimal(10,0)>
+-- !query 19 output
+1
+2
+
+
+-- !query 20
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 20 schema
+struct<CAST(1 AS SMALLINT):string>
+-- !query 20 output
+1
+2
+
+
+-- !query 21
+SELECT cast(1 as smallint) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 21 schema
+struct<>
+-- !query 21 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> smallint at the first column of the second table;
+
+
+-- !query 22
+SELECT cast(1 as smallint) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 22 schema
+struct<>
+-- !query 22 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> smallint at the first column of the second table;
+
+
+-- !query 23
+SELECT cast(1 as smallint) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 23 schema
+struct<>
+-- !query 23 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> smallint at the first column of the second table;
+
+
+-- !query 24
+SELECT cast(1 as smallint) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 24 schema
+struct<>
+-- !query 24 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> smallint at the first column of the second table;
+
+
+-- !query 25
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 25 schema
+struct<CAST(1 AS INT):int>
+-- !query 25 output
+1
+2
+
+
+-- !query 26
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 26 schema
+struct<CAST(1 AS INT):int>
+-- !query 26 output
+1
+2
+
+
+-- !query 27
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 27 schema
+struct<CAST(1 AS INT):int>
+-- !query 27 output
+1
+2
+
+
+-- !query 28
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 28 schema
+struct<CAST(1 AS INT):bigint>
+-- !query 28 output
+1
+2
+
+
+-- !query 29
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 29 schema
+struct<CAST(1 AS INT):float>
+-- !query 29 output
+1.0
+2.0
+
+
+-- !query 30
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 30 schema
+struct<CAST(1 AS INT):double>
+-- !query 30 output
+1.0
+2.0
+
+
+-- !query 31
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 31 schema
+struct<CAST(1 AS INT):decimal(10,0)>
+-- !query 31 output
+1
+2
+
+
+-- !query 32
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 32 schema
+struct<CAST(1 AS INT):string>
+-- !query 32 output
+1
+2
+
+
+-- !query 33
+SELECT cast(1 as int) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 33 schema
+struct<>
+-- !query 33 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> int at the first column of the second table;
+
+
+-- !query 34
+SELECT cast(1 as int) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 34 schema
+struct<>
+-- !query 34 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> int at the first column of the second table;
+
+
+-- !query 35
+SELECT cast(1 as int) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 35 schema
+struct<>
+-- !query 35 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> int at the first column of the second table;
+
+
+-- !query 36
+SELECT cast(1 as int) FROM t UNION SELECT cast('2017-12-11 09:30:00' as date) 
FROM t
+-- !query 36 schema
+struct<>
+-- !query 36 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> int at the first column of the second table;
+
+
+-- !query 37
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 37 schema
+struct<CAST(1 AS BIGINT):bigint>
+-- !query 37 output
+1
+2
+
+
+-- !query 38
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 38 schema
+struct<CAST(1 AS BIGINT):bigint>
+-- !query 38 output
+1
+2
+
+
+-- !query 39
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 39 schema
+struct<CAST(1 AS BIGINT):bigint>
+-- !query 39 output
+1
+2
+
+
+-- !query 40
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 40 schema
+struct<CAST(1 AS BIGINT):bigint>
+-- !query 40 output
+1
+2
+
+
+-- !query 41
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 41 schema
+struct<CAST(1 AS BIGINT):float>
+-- !query 41 output
+1.0
+2.0
+
+
+-- !query 42
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 42 schema
+struct<CAST(1 AS BIGINT):double>
+-- !query 42 output
+1.0
+2.0
+
+
+-- !query 43
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 43 schema
+struct<CAST(1 AS BIGINT):decimal(20,0)>
+-- !query 43 output
+1
+2
+
+
+-- !query 44
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 44 schema
+struct<CAST(1 AS BIGINT):string>
+-- !query 44 output
+1
+2
+
+
+-- !query 45
+SELECT cast(1 as bigint) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 45 schema
+struct<>
+-- !query 45 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> bigint at the first column of the second table;
+
+
+-- !query 46
+SELECT cast(1 as bigint) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 46 schema
+struct<>
+-- !query 46 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> bigint at the first column of the second table;
+
+
+-- !query 47
+SELECT cast(1 as bigint) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 47 schema
+struct<>
+-- !query 47 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> bigint at the first column of the second table;
+
+
+-- !query 48
+SELECT cast(1 as bigint) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 48 schema
+struct<>
+-- !query 48 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> bigint at the first column of the second table;
+
+
+-- !query 49
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 49 schema
+struct<CAST(1 AS FLOAT):float>
+-- !query 49 output
+1.0
+2.0
+
+
+-- !query 50
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 50 schema
+struct<CAST(1 AS FLOAT):float>
+-- !query 50 output
+1.0
+2.0
+
+
+-- !query 51
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 51 schema
+struct<CAST(1 AS FLOAT):float>
+-- !query 51 output
+1.0
+2.0
+
+
+-- !query 52
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 52 schema
+struct<CAST(1 AS FLOAT):float>
+-- !query 52 output
+1.0
+2.0
+
+
+-- !query 53
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 53 schema
+struct<CAST(1 AS FLOAT):float>
+-- !query 53 output
+1.0
+2.0
+
+
+-- !query 54
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 54 schema
+struct<CAST(1 AS FLOAT):double>
+-- !query 54 output
+1.0
+2.0
+
+
+-- !query 55
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 55 schema
+struct<CAST(1 AS FLOAT):double>
+-- !query 55 output
+1.0
+2.0
+
+
+-- !query 56
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 56 schema
+struct<CAST(1 AS FLOAT):string>
+-- !query 56 output
+1.0
+2
+
+
+-- !query 57
+SELECT cast(1 as float) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 57 schema
+struct<>
+-- !query 57 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> float at the first column of the second table;
+
+
+-- !query 58
+SELECT cast(1 as float) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 58 schema
+struct<>
+-- !query 58 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> float at the first column of the second table;
+
+
+-- !query 59
+SELECT cast(1 as float) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 59 schema
+struct<>
+-- !query 59 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> float at the first column of the second table;
+
+
+-- !query 60
+SELECT cast(1 as float) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 60 schema
+struct<>
+-- !query 60 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> float at the first column of the second table;
+
+
+-- !query 61
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 61 schema
+struct<CAST(1 AS DOUBLE):double>
+-- !query 61 output
+1.0
+2.0
+
+
+-- !query 62
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 62 schema
+struct<CAST(1 AS DOUBLE):double>
+-- !query 62 output
+1.0
+2.0
+
+
+-- !query 63
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 63 schema
+struct<CAST(1 AS DOUBLE):double>
+-- !query 63 output
+1.0
+2.0
+
+
+-- !query 64
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 64 schema
+struct<CAST(1 AS DOUBLE):double>
+-- !query 64 output
+1.0
+2.0
+
+
+-- !query 65
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 65 schema
+struct<CAST(1 AS DOUBLE):double>
+-- !query 65 output
+1.0
+2.0
+
+
+-- !query 66
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 66 schema
+struct<CAST(1 AS DOUBLE):double>
+-- !query 66 output
+1.0
+2.0
+
+
+-- !query 67
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 67 schema
+struct<CAST(1 AS DOUBLE):double>
+-- !query 67 output
+1.0
+2.0
+
+
+-- !query 68
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 68 schema
+struct<CAST(1 AS DOUBLE):string>
+-- !query 68 output
+1.0
+2
+
+
+-- !query 69
+SELECT cast(1 as double) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 69 schema
+struct<>
+-- !query 69 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> double at the first column of the second table;
+
+
+-- !query 70
+SELECT cast(1 as double) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 70 schema
+struct<>
+-- !query 70 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> double at the first column of the second table;
+
+
+-- !query 71
+SELECT cast(1 as double) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 71 schema
+struct<>
+-- !query 71 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> double at the first column of the second table;
+
+
+-- !query 72
+SELECT cast(1 as double) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 72 schema
+struct<>
+-- !query 72 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> double at the first column of the second table;
+
+
+-- !query 73
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 73 schema
+struct<CAST(1 AS DECIMAL(10,0)):decimal(10,0)>
+-- !query 73 output
+1
+2
+
+
+-- !query 74
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 74 schema
+struct<CAST(1 AS DECIMAL(10,0)):decimal(10,0)>
+-- !query 74 output
+1
+2
+
+
+-- !query 75
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 75 schema
+struct<CAST(1 AS DECIMAL(10,0)):decimal(10,0)>
+-- !query 75 output
+1
+2
+
+
+-- !query 76
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 76 schema
+struct<CAST(1 AS DECIMAL(10,0)):decimal(20,0)>
+-- !query 76 output
+1
+2
+
+
+-- !query 77
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 77 schema
+struct<CAST(1 AS DECIMAL(10,0)):double>
+-- !query 77 output
+1.0
+2.0
+
+
+-- !query 78
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 78 schema
+struct<CAST(1 AS DECIMAL(10,0)):double>
+-- !query 78 output
+1.0
+2.0
+
+
+-- !query 79
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as decimal(10, 0)) 
FROM t
+-- !query 79 schema
+struct<CAST(1 AS DECIMAL(10,0)):decimal(10,0)>
+-- !query 79 output
+1
+2
+
+
+-- !query 80
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 80 schema
+struct<CAST(1 AS DECIMAL(10,0)):string>
+-- !query 80 output
+1
+2
+
+
+-- !query 81
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 81 schema
+struct<>
+-- !query 81 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> decimal(10,0) at the first column of the second table;
+
+
+-- !query 82
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 82 schema
+struct<>
+-- !query 82 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> decimal(10,0) at the first column of the second table;
+
+
+-- !query 83
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast('2017-12-11 
09:30:00.0' as timestamp) FROM t
+-- !query 83 schema
+struct<>
+-- !query 83 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> decimal(10,0) at the first column of the second table;
+
+
+-- !query 84
+SELECT cast(1 as decimal(10, 0)) FROM t UNION SELECT cast('2017-12-11 
09:30:00' as date) FROM t
+-- !query 84 schema
+struct<>
+-- !query 84 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> decimal(10,0) at the first column of the second table;
+
+
+-- !query 85
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 85 schema
+struct<CAST(1 AS STRING):string>
+-- !query 85 output
+1
+2
+
+
+-- !query 86
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 86 schema
+struct<CAST(1 AS STRING):string>
+-- !query 86 output
+1
+2
+
+
+-- !query 87
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 87 schema
+struct<CAST(1 AS STRING):string>
+-- !query 87 output
+1
+2
+
+
+-- !query 88
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 88 schema
+struct<CAST(1 AS STRING):string>
+-- !query 88 output
+1
+2
+
+
+-- !query 89
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 89 schema
+struct<CAST(1 AS STRING):string>
+-- !query 89 output
+1
+2.0
+
+
+-- !query 90
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 90 schema
+struct<CAST(1 AS STRING):string>
+-- !query 90 output
+1
+2.0
+
+
+-- !query 91
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 91 schema
+struct<CAST(1 AS STRING):string>
+-- !query 91 output
+1
+2
+
+
+-- !query 92
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 92 schema
+struct<CAST(1 AS STRING):string>
+-- !query 92 output
+1
+2
+
+
+-- !query 93
+SELECT cast(1 as string) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 93 schema
+struct<>
+-- !query 93 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> string at the first column of the second table;
+
+
+-- !query 94
+SELECT cast(1 as string) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 94 schema
+struct<>
+-- !query 94 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> string at the first column of the second table;
+
+
+-- !query 95
+SELECT cast(1 as string) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 95 schema
+struct<CAST(1 AS STRING):string>
+-- !query 95 output
+1
+2017-12-11 09:30:00
+
+
+-- !query 96
+SELECT cast(1 as string) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 96 schema
+struct<CAST(1 AS STRING):string>
+-- !query 96 output
+1
+2017-12-11
+
+
+-- !query 97
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 97 schema
+struct<>
+-- !query 97 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
tinyint <> binary at the first column of the second table;
+
+
+-- !query 98
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 98 schema
+struct<>
+-- !query 98 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
smallint <> binary at the first column of the second table;
+
+
+-- !query 99
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 99 schema
+struct<>
+-- !query 99 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. int <> 
binary at the first column of the second table;
+
+
+-- !query 100
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 100 schema
+struct<>
+-- !query 100 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. bigint 
<> binary at the first column of the second table;
+
+
+-- !query 101
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 101 schema
+struct<>
+-- !query 101 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. float 
<> binary at the first column of the second table;
+
+
+-- !query 102
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 102 schema
+struct<>
+-- !query 102 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. double 
<> binary at the first column of the second table;
+
+
+-- !query 103
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 103 schema
+struct<>
+-- !query 103 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
decimal(10,0) <> binary at the first column of the second table;
+
+
+-- !query 104
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 104 schema
+struct<>
+-- !query 104 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. string 
<> binary at the first column of the second table;
+
+
+-- !query 105
+SELECT cast('1' as binary) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 105 schema
+struct<CAST(1 AS BINARY):binary>
+-- !query 105 output
+1
+2
+
+
+-- !query 106
+SELECT cast('1' as binary) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 106 schema
+struct<>
+-- !query 106 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> binary at the first column of the second table;
+
+
+-- !query 107
+SELECT cast('1' as binary) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 107 schema
+struct<>
+-- !query 107 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> binary at the first column of the second table;
+
+
+-- !query 108
+SELECT cast('1' as binary) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 108 schema
+struct<>
+-- !query 108 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> binary at the first column of the second table;
+
+
+-- !query 109
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as tinyint) FROM t
+-- !query 109 schema
+struct<>
+-- !query 109 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
tinyint <> boolean at the first column of the second table;
+
+
+-- !query 110
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as smallint) FROM t
+-- !query 110 schema
+struct<>
+-- !query 110 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
smallint <> boolean at the first column of the second table;
+
+
+-- !query 111
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as int) FROM t
+-- !query 111 schema
+struct<>
+-- !query 111 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. int <> 
boolean at the first column of the second table;
+
+
+-- !query 112
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as bigint) FROM t
+-- !query 112 schema
+struct<>
+-- !query 112 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. bigint 
<> boolean at the first column of the second table;
+
+
+-- !query 113
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as float) FROM t
+-- !query 113 schema
+struct<>
+-- !query 113 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. float 
<> boolean at the first column of the second table;
+
+
+-- !query 114
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as double) FROM t
+-- !query 114 schema
+struct<>
+-- !query 114 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. double 
<> boolean at the first column of the second table;
+
+
+-- !query 115
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as decimal(10, 0)) FROM t
+-- !query 115 schema
+struct<>
+-- !query 115 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
decimal(10,0) <> boolean at the first column of the second table;
+
+
+-- !query 116
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as string) FROM t
+-- !query 116 schema
+struct<>
+-- !query 116 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. string 
<> boolean at the first column of the second table;
+
+
+-- !query 117
+SELECT cast(1 as boolean) FROM t UNION SELECT cast('2' as binary) FROM t
+-- !query 117 schema
+struct<>
+-- !query 117 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> boolean at the first column of the second table;
+
+
+-- !query 118
+SELECT cast(1 as boolean) FROM t UNION SELECT cast(2 as boolean) FROM t
+-- !query 118 schema
+struct<CAST(1 AS BOOLEAN):boolean>
+-- !query 118 output
+true
+
+
+-- !query 119
+SELECT cast(1 as boolean) FROM t UNION SELECT cast('2017-12-11 09:30:00.0' as 
timestamp) FROM t
+-- !query 119 schema
+struct<>
+-- !query 119 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
timestamp <> boolean at the first column of the second table;
+
+
+-- !query 120
+SELECT cast(1 as boolean) FROM t UNION SELECT cast('2017-12-11 09:30:00' as 
date) FROM t
+-- !query 120 schema
+struct<>
+-- !query 120 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. date 
<> boolean at the first column of the second table;
+
+
+-- !query 121
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as tinyint) FROM t
+-- !query 121 schema
+struct<>
+-- !query 121 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
tinyint <> timestamp at the first column of the second table;
+
+
+-- !query 122
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as smallint) FROM t
+-- !query 122 schema
+struct<>
+-- !query 122 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
smallint <> timestamp at the first column of the second table;
+
+
+-- !query 123
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as int) FROM t
+-- !query 123 schema
+struct<>
+-- !query 123 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. int <> 
timestamp at the first column of the second table;
+
+
+-- !query 124
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as bigint) FROM t
+-- !query 124 schema
+struct<>
+-- !query 124 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. bigint 
<> timestamp at the first column of the second table;
+
+
+-- !query 125
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as float) FROM t
+-- !query 125 schema
+struct<>
+-- !query 125 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. float 
<> timestamp at the first column of the second table;
+
+
+-- !query 126
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as double) FROM t
+-- !query 126 schema
+struct<>
+-- !query 126 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. double 
<> timestamp at the first column of the second table;
+
+
+-- !query 127
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as decimal(10, 0)) FROM t
+-- !query 127 schema
+struct<>
+-- !query 127 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
decimal(10,0) <> timestamp at the first column of the second table;
+
+
+-- !query 128
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as string) FROM t
+-- !query 128 schema
+struct<CAST(2017-12-12 09:30:00.0 AS TIMESTAMP):string>
+-- !query 128 output
+2
+2017-12-12 09:30:00
+
+
+-- !query 129
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast('2' 
as binary) FROM t
+-- !query 129 schema
+struct<>
+-- !query 129 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> timestamp at the first column of the second table;
+
+
+-- !query 130
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT cast(2 
as boolean) FROM t
+-- !query 130 schema
+struct<>
+-- !query 130 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> timestamp at the first column of the second table;
+
+
+-- !query 131
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT 
cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 131 schema
+struct<CAST(2017-12-12 09:30:00.0 AS TIMESTAMP):timestamp>
+-- !query 131 output
+2017-12-11 09:30:00
+2017-12-12 09:30:00
+
+
+-- !query 132
+SELECT cast('2017-12-12 09:30:00.0' as timestamp) FROM t UNION SELECT 
cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 132 schema
+struct<CAST(2017-12-12 09:30:00.0 AS TIMESTAMP):timestamp>
+-- !query 132 output
+2017-12-11 00:00:00
+2017-12-12 09:30:00
+
+
+-- !query 133
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
tinyint) FROM t
+-- !query 133 schema
+struct<>
+-- !query 133 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
tinyint <> date at the first column of the second table;
+
+
+-- !query 134
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
smallint) FROM t
+-- !query 134 schema
+struct<>
+-- !query 134 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
smallint <> date at the first column of the second table;
+
+
+-- !query 135
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as int) 
FROM t
+-- !query 135 schema
+struct<>
+-- !query 135 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. int <> 
date at the first column of the second table;
+
+
+-- !query 136
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
bigint) FROM t
+-- !query 136 schema
+struct<>
+-- !query 136 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. bigint 
<> date at the first column of the second table;
+
+
+-- !query 137
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
float) FROM t
+-- !query 137 schema
+struct<>
+-- !query 137 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. float 
<> date at the first column of the second table;
+
+
+-- !query 138
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
double) FROM t
+-- !query 138 schema
+struct<>
+-- !query 138 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. double 
<> date at the first column of the second table;
+
+
+-- !query 139
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
decimal(10, 0)) FROM t
+-- !query 139 schema
+struct<>
+-- !query 139 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
decimal(10,0) <> date at the first column of the second table;
+
+
+-- !query 140
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
string) FROM t
+-- !query 140 schema
+struct<CAST(2017-12-12 09:30:00 AS DATE):string>
+-- !query 140 output
+2
+2017-12-12
+
+
+-- !query 141
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast('2' as 
binary) FROM t
+-- !query 141 schema
+struct<>
+-- !query 141 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. binary 
<> date at the first column of the second table;
+
+
+-- !query 142
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT cast(2 as 
boolean) FROM t
+-- !query 142 schema
+struct<>
+-- !query 142 output
+org.apache.spark.sql.AnalysisException
+Union can only be performed on tables with the compatible column types. 
boolean <> date at the first column of the second table;
+
+
+-- !query 143
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT 
cast('2017-12-11 09:30:00.0' as timestamp) FROM t
+-- !query 143 schema
+struct<CAST(2017-12-12 09:30:00 AS DATE):timestamp>
+-- !query 143 output
+2017-12-11 09:30:00
+2017-12-12 00:00:00
+
+
+-- !query 144
+SELECT cast('2017-12-12 09:30:00' as date) FROM t UNION SELECT 
cast('2017-12-11 09:30:00' as date) FROM t
+-- !query 144 schema
+struct<CAST(2017-12-12 09:30:00 AS DATE):date>
+-- !query 144 output
+2017-12-11
+2017-12-12


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@spark.apache.org
For additional commands, e-mail: commits-h...@spark.apache.org

Reply via email to