From f9da9103eacdad8a7d544e9d17b8a54d6b7e01c5 Mon Sep 17 00:00:00 2001 From: Yuming Wang Date: Tue, 12 Dec 2017 15:59:11 +0800 Subject: [PATCH 1/2] Basic tests for IfCoercion and CaseWhenCoercion --- .../typeCoercion/native/caseWhenCoercion.sql | 200 +++ .../inputs/typeCoercion/native/ifCoercion.sql | 200 +++ .../native/caseWhenCoercion.sql.out | 1440 +++++++++++++++++ .../typeCoercion/native/ifCoercion.sql.out | 1440 +++++++++++++++++ 4 files changed, 3280 insertions(+) create mode 100644 sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql create mode 100644 sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql create mode 100644 sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out create mode 100644 sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out diff --git a/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql new file mode 100644 index 0000000000000..d3c19fb45a1c4 --- /dev/null +++ b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql @@ -0,0 +1,200 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +CREATE TEMPORARY VIEW t AS SELECT 1; + +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; + +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as tinyint) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as smallint) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as short) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as int) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as bigint) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as float) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as double) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as decimal(10, 0)) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as string) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2' as binary) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as boolean) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; diff --git a/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql new file mode 100644 index 0000000000000..764419bfca37b --- /dev/null +++ b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql @@ -0,0 +1,200 @@ +-- +-- Licensed to the Apache Software Foundation (ASF) under one or more +-- contributor license agreements. See the NOTICE file distributed with +-- this work for additional information regarding copyright ownership. +-- The ASF licenses this file to You under the Apache License, Version 2.0 +-- (the "License"); you may not use this file except in compliance with +-- the License. You may obtain a copy of the License at +-- +-- http://www.apache.org/licenses/LICENSE-2.0 +-- +-- Unless required by applicable law or agreed to in writing, software +-- distributed under the License is distributed on an "AS IS" BASIS, +-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +-- See the License for the specific language governing permissions and +-- limitations under the License. +-- + +CREATE TEMPORARY VIEW t AS SELECT 1; + +SELECT IF(true, cast(1 as tinyint), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as tinyint), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as smallint), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as smallint), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as smallint), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as short), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as short), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as short), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as int), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as int), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as int), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as bigint), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as bigint), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as bigint), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as float), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as float), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as float), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as float), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as float), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as double), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as double), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as double), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as double), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as double), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as decimal(10, 0)), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as string), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as string), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as string), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as string), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as string), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast('1' as binary), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as smallint)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as short)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as int)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as bigint)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as float)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as double)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as string)) FROM t; +SELECT IF(true, cast('1' as binary), cast('2' as binary)) FROM t; +SELECT IF(true, cast('1' as binary), cast(2 as boolean)) FROM t; +SELECT IF(true, cast('1' as binary), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast('1' as binary), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast(1 as boolean), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as smallint)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as short)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as int)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as bigint)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as float)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as double)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as string)) FROM t; +SELECT IF(true, cast(1 as boolean), cast('2' as binary)) FROM t; +SELECT IF(true, cast(1 as boolean), cast(2 as boolean)) FROM t; +SELECT IF(true, cast(1 as boolean), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast(1 as boolean), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as smallint)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as short)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as int)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as bigint)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as float)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as double)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as string)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2' as binary)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as boolean)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2017-12-11 09:30:00' as date)) FROM t; + +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as tinyint)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as smallint)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as short)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as int)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as bigint)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as float)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as double)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as decimal(10, 0))) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as string)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2' as binary)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as boolean)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2017-12-11 09:30:00' as date)) FROM t; diff --git a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out new file mode 100644 index 0000000000000..2422a1838d241 --- /dev/null +++ b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out @@ -0,0 +1,1440 @@ +-- Automatically generated by SQLQueryTestSuite +-- Number of queries: 170 + + +-- !query 0 +CREATE TEMPORARY VIEW t AS SELECT 1 +-- !query 0 schema +struct<> +-- !query 0 output + + + +-- !query 1 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as tinyint) END FROM t +-- !query 1 schema +struct +-- !query 1 output +1 + + +-- !query 2 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as smallint) END FROM t +-- !query 2 schema +struct +-- !query 2 output +1 + + +-- !query 3 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as short) END FROM t +-- !query 3 schema +struct +-- !query 3 output +1 + + +-- !query 4 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as int) END FROM t +-- !query 4 schema +struct +-- !query 4 output +1 + + +-- !query 5 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as bigint) END FROM t +-- !query 5 schema +struct +-- !query 5 output +1 + + +-- !query 6 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as float) END FROM t +-- !query 6 schema +struct +-- !query 6 output +1.0 + + +-- !query 7 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as double) END FROM t +-- !query 7 schema +struct +-- !query 7 output +1.0 + + +-- !query 8 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 8 schema +struct +-- !query 8 output +1 + + +-- !query 9 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as string) END FROM t +-- !query 9 schema +struct +-- !query 9 output +1 + + +-- !query 10 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2' as binary) END FROM t +-- !query 10 schema +struct<> +-- !query 10 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 11 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as boolean) END FROM t +-- !query 11 schema +struct<> +-- !query 11 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 12 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 12 schema +struct<> +-- !query 12 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 13 +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 13 schema +struct<> +-- !query 13 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 14 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as tinyint) END FROM t +-- !query 14 schema +struct +-- !query 14 output +1 + + +-- !query 15 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as smallint) END FROM t +-- !query 15 schema +struct +-- !query 15 output +1 + + +-- !query 16 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as short) END FROM t +-- !query 16 schema +struct +-- !query 16 output +1 + + +-- !query 17 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as int) END FROM t +-- !query 17 schema +struct +-- !query 17 output +1 + + +-- !query 18 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as bigint) END FROM t +-- !query 18 schema +struct +-- !query 18 output +1 + + +-- !query 19 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as float) END FROM t +-- !query 19 schema +struct +-- !query 19 output +1.0 + + +-- !query 20 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as double) END FROM t +-- !query 20 schema +struct +-- !query 20 output +1.0 + + +-- !query 21 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 21 schema +struct +-- !query 21 output +1 + + +-- !query 22 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as string) END FROM t +-- !query 22 schema +struct +-- !query 22 output +1 + + +-- !query 23 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2' as binary) END FROM t +-- !query 23 schema +struct<> +-- !query 23 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 24 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as boolean) END FROM t +-- !query 24 schema +struct<> +-- !query 24 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 25 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 25 schema +struct<> +-- !query 25 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 26 +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 26 schema +struct<> +-- !query 26 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 27 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as tinyint) END FROM t +-- !query 27 schema +struct +-- !query 27 output +1 + + +-- !query 28 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as smallint) END FROM t +-- !query 28 schema +struct +-- !query 28 output +1 + + +-- !query 29 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as short) END FROM t +-- !query 29 schema +struct +-- !query 29 output +1 + + +-- !query 30 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as int) END FROM t +-- !query 30 schema +struct +-- !query 30 output +1 + + +-- !query 31 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as bigint) END FROM t +-- !query 31 schema +struct +-- !query 31 output +1 + + +-- !query 32 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as float) END FROM t +-- !query 32 schema +struct +-- !query 32 output +1.0 + + +-- !query 33 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as double) END FROM t +-- !query 33 schema +struct +-- !query 33 output +1.0 + + +-- !query 34 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 34 schema +struct +-- !query 34 output +1 + + +-- !query 35 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as string) END FROM t +-- !query 35 schema +struct +-- !query 35 output +1 + + +-- !query 36 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2' as binary) END FROM t +-- !query 36 schema +struct<> +-- !query 36 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 37 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as boolean) END FROM t +-- !query 37 schema +struct<> +-- !query 37 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 38 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 38 schema +struct<> +-- !query 38 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 39 +SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 39 schema +struct<> +-- !query 39 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 40 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as tinyint) END FROM t +-- !query 40 schema +struct +-- !query 40 output +1 + + +-- !query 41 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as smallint) END FROM t +-- !query 41 schema +struct +-- !query 41 output +1 + + +-- !query 42 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as short) END FROM t +-- !query 42 schema +struct +-- !query 42 output +1 + + +-- !query 43 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as int) END FROM t +-- !query 43 schema +struct +-- !query 43 output +1 + + +-- !query 44 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as bigint) END FROM t +-- !query 44 schema +struct +-- !query 44 output +1 + + +-- !query 45 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as float) END FROM t +-- !query 45 schema +struct +-- !query 45 output +1.0 + + +-- !query 46 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as double) END FROM t +-- !query 46 schema +struct +-- !query 46 output +1.0 + + +-- !query 47 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 47 schema +struct +-- !query 47 output +1 + + +-- !query 48 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as string) END FROM t +-- !query 48 schema +struct +-- !query 48 output +1 + + +-- !query 49 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2' as binary) END FROM t +-- !query 49 schema +struct<> +-- !query 49 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 50 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as boolean) END FROM t +-- !query 50 schema +struct<> +-- !query 50 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 51 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 51 schema +struct<> +-- !query 51 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 52 +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 52 schema +struct<> +-- !query 52 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 53 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as tinyint) END FROM t +-- !query 53 schema +struct +-- !query 53 output +1 + + +-- !query 54 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as smallint) END FROM t +-- !query 54 schema +struct +-- !query 54 output +1 + + +-- !query 55 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as short) END FROM t +-- !query 55 schema +struct +-- !query 55 output +1 + + +-- !query 56 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as int) END FROM t +-- !query 56 schema +struct +-- !query 56 output +1 + + +-- !query 57 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as bigint) END FROM t +-- !query 57 schema +struct +-- !query 57 output +1 + + +-- !query 58 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as float) END FROM t +-- !query 58 schema +struct +-- !query 58 output +1.0 + + +-- !query 59 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as double) END FROM t +-- !query 59 schema +struct +-- !query 59 output +1.0 + + +-- !query 60 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 60 schema +struct +-- !query 60 output +1 + + +-- !query 61 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as string) END FROM t +-- !query 61 schema +struct +-- !query 61 output +1 + + +-- !query 62 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2' as binary) END FROM t +-- !query 62 schema +struct<> +-- !query 62 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 63 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as boolean) END FROM t +-- !query 63 schema +struct<> +-- !query 63 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 64 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 64 schema +struct<> +-- !query 64 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 65 +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 65 schema +struct<> +-- !query 65 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 66 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as tinyint) END FROM t +-- !query 66 schema +struct +-- !query 66 output +1.0 + + +-- !query 67 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as smallint) END FROM t +-- !query 67 schema +struct +-- !query 67 output +1.0 + + +-- !query 68 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as short) END FROM t +-- !query 68 schema +struct +-- !query 68 output +1.0 + + +-- !query 69 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as int) END FROM t +-- !query 69 schema +struct +-- !query 69 output +1.0 + + +-- !query 70 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as bigint) END FROM t +-- !query 70 schema +struct +-- !query 70 output +1.0 + + +-- !query 71 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as float) END FROM t +-- !query 71 schema +struct +-- !query 71 output +1.0 + + +-- !query 72 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as double) END FROM t +-- !query 72 schema +struct +-- !query 72 output +1.0 + + +-- !query 73 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 73 schema +struct +-- !query 73 output +1.0 + + +-- !query 74 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as string) END FROM t +-- !query 74 schema +struct +-- !query 74 output +1.0 + + +-- !query 75 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2' as binary) END FROM t +-- !query 75 schema +struct<> +-- !query 75 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 76 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as boolean) END FROM t +-- !query 76 schema +struct<> +-- !query 76 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 77 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 77 schema +struct<> +-- !query 77 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 78 +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 78 schema +struct<> +-- !query 78 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 79 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as tinyint) END FROM t +-- !query 79 schema +struct +-- !query 79 output +1.0 + + +-- !query 80 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as smallint) END FROM t +-- !query 80 schema +struct +-- !query 80 output +1.0 + + +-- !query 81 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as short) END FROM t +-- !query 81 schema +struct +-- !query 81 output +1.0 + + +-- !query 82 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as int) END FROM t +-- !query 82 schema +struct +-- !query 82 output +1.0 + + +-- !query 83 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as bigint) END FROM t +-- !query 83 schema +struct +-- !query 83 output +1.0 + + +-- !query 84 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as float) END FROM t +-- !query 84 schema +struct +-- !query 84 output +1.0 + + +-- !query 85 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as double) END FROM t +-- !query 85 schema +struct +-- !query 85 output +1.0 + + +-- !query 86 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 86 schema +struct +-- !query 86 output +1.0 + + +-- !query 87 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as string) END FROM t +-- !query 87 schema +struct +-- !query 87 output +1.0 + + +-- !query 88 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2' as binary) END FROM t +-- !query 88 schema +struct<> +-- !query 88 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 89 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as boolean) END FROM t +-- !query 89 schema +struct<> +-- !query 89 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 90 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 90 schema +struct<> +-- !query 90 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 91 +SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 91 schema +struct<> +-- !query 91 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 92 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as tinyint) END FROM t +-- !query 92 schema +struct +-- !query 92 output +1 + + +-- !query 93 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as smallint) END FROM t +-- !query 93 schema +struct +-- !query 93 output +1 + + +-- !query 94 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as short) END FROM t +-- !query 94 schema +struct +-- !query 94 output +1 + + +-- !query 95 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as int) END FROM t +-- !query 95 schema +struct +-- !query 95 output +1 + + +-- !query 96 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as bigint) END FROM t +-- !query 96 schema +struct +-- !query 96 output +1 + + +-- !query 97 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as float) END FROM t +-- !query 97 schema +struct +-- !query 97 output +1.0 + + +-- !query 98 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as double) END FROM t +-- !query 98 schema +struct +-- !query 98 output +1.0 + + +-- !query 99 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 99 schema +struct +-- !query 99 output +1 + + +-- !query 100 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as string) END FROM t +-- !query 100 schema +struct +-- !query 100 output +1 + + +-- !query 101 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2' as binary) END FROM t +-- !query 101 schema +struct<> +-- !query 101 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 102 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as boolean) END FROM t +-- !query 102 schema +struct<> +-- !query 102 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 103 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 103 schema +struct<> +-- !query 103 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 104 +SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 104 schema +struct<> +-- !query 104 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 105 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as tinyint) END FROM t +-- !query 105 schema +struct +-- !query 105 output +1 + + +-- !query 106 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as smallint) END FROM t +-- !query 106 schema +struct +-- !query 106 output +1 + + +-- !query 107 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as short) END FROM t +-- !query 107 schema +struct +-- !query 107 output +1 + + +-- !query 108 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as int) END FROM t +-- !query 108 schema +struct +-- !query 108 output +1 + + +-- !query 109 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as bigint) END FROM t +-- !query 109 schema +struct +-- !query 109 output +1 + + +-- !query 110 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as float) END FROM t +-- !query 110 schema +struct +-- !query 110 output +1 + + +-- !query 111 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as double) END FROM t +-- !query 111 schema +struct +-- !query 111 output +1 + + +-- !query 112 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 112 schema +struct +-- !query 112 output +1 + + +-- !query 113 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as string) END FROM t +-- !query 113 schema +struct +-- !query 113 output +1 + + +-- !query 114 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2' as binary) END FROM t +-- !query 114 schema +struct<> +-- !query 114 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS STRING) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 115 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as boolean) END FROM t +-- !query 115 schema +struct<> +-- !query 115 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS STRING) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 116 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 116 schema +struct +-- !query 116 output +1 + + +-- !query 117 +SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 117 schema +struct +-- !query 117 output +1 + + +-- !query 118 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as tinyint) END FROM t +-- !query 118 schema +struct<> +-- !query 118 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 119 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as smallint) END FROM t +-- !query 119 schema +struct<> +-- !query 119 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 120 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as short) END FROM t +-- !query 120 schema +struct<> +-- !query 120 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 121 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as int) END FROM t +-- !query 121 schema +struct<> +-- !query 121 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 122 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as bigint) END FROM t +-- !query 122 schema +struct<> +-- !query 122 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 123 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as float) END FROM t +-- !query 123 schema +struct<> +-- !query 123 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 124 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as double) END FROM t +-- !query 124 schema +struct<> +-- !query 124 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 125 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 125 schema +struct<> +-- !query 125 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 126 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as string) END FROM t +-- !query 126 schema +struct<> +-- !query 126 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS STRING) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 127 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2' as binary) END FROM t +-- !query 127 schema +struct +-- !query 127 output +1 + + +-- !query 128 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as boolean) END FROM t +-- !query 128 schema +struct<> +-- !query 128 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 129 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 129 schema +struct<> +-- !query 129 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 130 +SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 130 schema +struct<> +-- !query 130 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 131 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as tinyint) END FROM t +-- !query 131 schema +struct<> +-- !query 131 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 132 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as smallint) END FROM t +-- !query 132 schema +struct<> +-- !query 132 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 133 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as short) END FROM t +-- !query 133 schema +struct<> +-- !query 133 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 134 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as int) END FROM t +-- !query 134 schema +struct<> +-- !query 134 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 135 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as bigint) END FROM t +-- !query 135 schema +struct<> +-- !query 135 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 136 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as float) END FROM t +-- !query 136 schema +struct<> +-- !query 136 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 137 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as double) END FROM t +-- !query 137 schema +struct<> +-- !query 137 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 138 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 138 schema +struct<> +-- !query 138 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 139 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as string) END FROM t +-- !query 139 schema +struct<> +-- !query 139 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS STRING) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 140 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2' as binary) END FROM t +-- !query 140 schema +struct<> +-- !query 140 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 141 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as boolean) END FROM t +-- !query 141 schema +struct +-- !query 141 output +true + + +-- !query 142 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 142 schema +struct<> +-- !query 142 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 143 +SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 143 schema +struct<> +-- !query 143 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 144 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as tinyint) END FROM t +-- !query 144 schema +struct<> +-- !query 144 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 145 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as smallint) END FROM t +-- !query 145 schema +struct<> +-- !query 145 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 146 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as short) END FROM t +-- !query 146 schema +struct<> +-- !query 146 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 147 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as int) END FROM t +-- !query 147 schema +struct<> +-- !query 147 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 148 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as bigint) END FROM t +-- !query 148 schema +struct<> +-- !query 148 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 149 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as float) END FROM t +-- !query 149 schema +struct<> +-- !query 149 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 150 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as double) END FROM t +-- !query 150 schema +struct<> +-- !query 150 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 151 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 151 schema +struct<> +-- !query 151 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 152 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as string) END FROM t +-- !query 152 schema +struct +-- !query 152 output +2017-12-12 09:30:00 + + +-- !query 153 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2' as binary) END FROM t +-- !query 153 schema +struct<> +-- !query 153 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 154 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as boolean) END FROM t +-- !query 154 schema +struct<> +-- !query 154 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 155 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 155 schema +struct +-- !query 155 output +2017-12-12 09:30:00 + + +-- !query 156 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 156 schema +struct +-- !query 156 output +2017-12-12 09:30:00 + + +-- !query 157 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as tinyint) END FROM t +-- !query 157 schema +struct<> +-- !query 157 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 158 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as smallint) END FROM t +-- !query 158 schema +struct<> +-- !query 158 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 159 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as short) END FROM t +-- !query 159 schema +struct<> +-- !query 159 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 160 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as int) END FROM t +-- !query 160 schema +struct<> +-- !query 160 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 161 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as bigint) END FROM t +-- !query 161 schema +struct<> +-- !query 161 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 162 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as float) END FROM t +-- !query 162 schema +struct<> +-- !query 162 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 163 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as double) END FROM t +-- !query 163 schema +struct<> +-- !query 163 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 164 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as decimal(10, 0)) END FROM t +-- !query 164 schema +struct<> +-- !query 164 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 165 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as string) END FROM t +-- !query 165 schema +struct +-- !query 165 output +2017-12-12 + + +-- !query 166 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2' as binary) END FROM t +-- !query 166 schema +struct<> +-- !query 166 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 167 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as boolean) END FROM t +-- !query 167 schema +struct<> +-- !query 167 output +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 + + +-- !query 168 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +-- !query 168 schema +struct +-- !query 168 output +2017-12-12 00:00:00 + + +-- !query 169 +SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +-- !query 169 schema +struct +-- !query 169 output +2017-12-12 diff --git a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out new file mode 100644 index 0000000000000..3f8dd8336e82a --- /dev/null +++ b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out @@ -0,0 +1,1440 @@ +-- Automatically generated by SQLQueryTestSuite +-- Number of queries: 170 + + +-- !query 0 +CREATE TEMPORARY VIEW t AS SELECT 1 +-- !query 0 schema +struct<> +-- !query 0 output + + + +-- !query 1 +SELECT IF(true, cast(1 as tinyint), cast(2 as tinyint)) FROM t +-- !query 1 schema +struct<(IF(true, CAST(1 AS TINYINT), CAST(2 AS TINYINT))):tinyint> +-- !query 1 output +1 + + +-- !query 2 +SELECT IF(true, cast(1 as tinyint), cast(2 as smallint)) FROM t +-- !query 2 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +-- !query 2 output +1 + + +-- !query 3 +SELECT IF(true, cast(1 as tinyint), cast(2 as short)) FROM t +-- !query 3 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +-- !query 3 output +1 + + +-- !query 4 +SELECT IF(true, cast(1 as tinyint), cast(2 as int)) FROM t +-- !query 4 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS INT), CAST(2 AS INT))):int> +-- !query 4 output +1 + + +-- !query 5 +SELECT IF(true, cast(1 as tinyint), cast(2 as bigint)) FROM t +-- !query 5 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +-- !query 5 output +1 + + +-- !query 6 +SELECT IF(true, cast(1 as tinyint), cast(2 as float)) FROM t +-- !query 6 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS FLOAT), CAST(2 AS FLOAT))):float> +-- !query 6 output +1.0 + + +-- !query 7 +SELECT IF(true, cast(1 as tinyint), cast(2 as double)) FROM t +-- !query 7 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 7 output +1.0 + + +-- !query 8 +SELECT IF(true, cast(1 as tinyint), cast(2 as decimal(10, 0))) FROM t +-- !query 8 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 8 output +1 + + +-- !query 9 +SELECT IF(true, cast(1 as tinyint), cast(2 as string)) FROM t +-- !query 9 schema +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS STRING), CAST(2 AS STRING))):string> +-- !query 9 output +1 + + +-- !query 10 +SELECT IF(true, cast(1 as tinyint), cast('2' as binary)) FROM t +-- !query 10 schema +struct<> +-- !query 10 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2' AS BINARY)))' (tinyint and binary).; line 1 pos 7 + + +-- !query 11 +SELECT IF(true, cast(1 as tinyint), cast(2 as boolean)) FROM t +-- !query 11 schema +struct<> +-- !query 11 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST(2 AS BOOLEAN)))' (tinyint and boolean).; line 1 pos 7 + + +-- !query 12 +SELECT IF(true, cast(1 as tinyint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 12 schema +struct<> +-- !query 12 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (tinyint and timestamp).; line 1 pos 7 + + +-- !query 13 +SELECT IF(true, cast(1 as tinyint), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 13 schema +struct<> +-- !query 13 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00' AS DATE)))' (tinyint and date).; line 1 pos 7 + + +-- !query 14 +SELECT IF(true, cast(1 as smallint), cast(2 as tinyint)) FROM t +-- !query 14 schema +struct<(IF(true, CAST(1 AS SMALLINT), CAST(CAST(2 AS TINYINT) AS SMALLINT))):smallint> +-- !query 14 output +1 + + +-- !query 15 +SELECT IF(true, cast(1 as smallint), cast(2 as smallint)) FROM t +-- !query 15 schema +struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +-- !query 15 output +1 + + +-- !query 16 +SELECT IF(true, cast(1 as smallint), cast(2 as short)) FROM t +-- !query 16 schema +struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +-- !query 16 output +1 + + +-- !query 17 +SELECT IF(true, cast(1 as smallint), cast(2 as int)) FROM t +-- !query 17 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS INT), CAST(2 AS INT))):int> +-- !query 17 output +1 + + +-- !query 18 +SELECT IF(true, cast(1 as smallint), cast(2 as bigint)) FROM t +-- !query 18 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +-- !query 18 output +1 + + +-- !query 19 +SELECT IF(true, cast(1 as smallint), cast(2 as float)) FROM t +-- !query 19 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS FLOAT), CAST(2 AS FLOAT))):float> +-- !query 19 output +1.0 + + +-- !query 20 +SELECT IF(true, cast(1 as smallint), cast(2 as double)) FROM t +-- !query 20 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 20 output +1.0 + + +-- !query 21 +SELECT IF(true, cast(1 as smallint), cast(2 as decimal(10, 0))) FROM t +-- !query 21 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 21 output +1 + + +-- !query 22 +SELECT IF(true, cast(1 as smallint), cast(2 as string)) FROM t +-- !query 22 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS STRING), CAST(2 AS STRING))):string> +-- !query 22 output +1 + + +-- !query 23 +SELECT IF(true, cast(1 as smallint), cast('2' as binary)) FROM t +-- !query 23 schema +struct<> +-- !query 23 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' (smallint and binary).; line 1 pos 7 + + +-- !query 24 +SELECT IF(true, cast(1 as smallint), cast(2 as boolean)) FROM t +-- !query 24 schema +struct<> +-- !query 24 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' (smallint and boolean).; line 1 pos 7 + + +-- !query 25 +SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 25 schema +struct<> +-- !query 25 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (smallint and timestamp).; line 1 pos 7 + + +-- !query 26 +SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 26 schema +struct<> +-- !query 26 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' (smallint and date).; line 1 pos 7 + + +-- !query 27 +SELECT IF(true, cast(1 as short), cast(2 as tinyint)) FROM t +-- !query 27 schema +struct<(IF(true, CAST(1 AS SMALLINT), CAST(CAST(2 AS TINYINT) AS SMALLINT))):smallint> +-- !query 27 output +1 + + +-- !query 28 +SELECT IF(true, cast(1 as short), cast(2 as smallint)) FROM t +-- !query 28 schema +struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +-- !query 28 output +1 + + +-- !query 29 +SELECT IF(true, cast(1 as short), cast(2 as short)) FROM t +-- !query 29 schema +struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +-- !query 29 output +1 + + +-- !query 30 +SELECT IF(true, cast(1 as short), cast(2 as int)) FROM t +-- !query 30 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS INT), CAST(2 AS INT))):int> +-- !query 30 output +1 + + +-- !query 31 +SELECT IF(true, cast(1 as short), cast(2 as bigint)) FROM t +-- !query 31 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +-- !query 31 output +1 + + +-- !query 32 +SELECT IF(true, cast(1 as short), cast(2 as float)) FROM t +-- !query 32 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS FLOAT), CAST(2 AS FLOAT))):float> +-- !query 32 output +1.0 + + +-- !query 33 +SELECT IF(true, cast(1 as short), cast(2 as double)) FROM t +-- !query 33 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 33 output +1.0 + + +-- !query 34 +SELECT IF(true, cast(1 as short), cast(2 as decimal(10, 0))) FROM t +-- !query 34 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 34 output +1 + + +-- !query 35 +SELECT IF(true, cast(1 as short), cast(2 as string)) FROM t +-- !query 35 schema +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS STRING), CAST(2 AS STRING))):string> +-- !query 35 output +1 + + +-- !query 36 +SELECT IF(true, cast(1 as short), cast('2' as binary)) FROM t +-- !query 36 schema +struct<> +-- !query 36 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' (smallint and binary).; line 1 pos 7 + + +-- !query 37 +SELECT IF(true, cast(1 as short), cast(2 as boolean)) FROM t +-- !query 37 schema +struct<> +-- !query 37 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' (smallint and boolean).; line 1 pos 7 + + +-- !query 38 +SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 38 schema +struct<> +-- !query 38 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (smallint and timestamp).; line 1 pos 7 + + +-- !query 39 +SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 39 schema +struct<> +-- !query 39 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' (smallint and date).; line 1 pos 7 + + +-- !query 40 +SELECT IF(true, cast(1 as int), cast(2 as tinyint)) FROM t +-- !query 40 schema +struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS TINYINT) AS INT))):int> +-- !query 40 output +1 + + +-- !query 41 +SELECT IF(true, cast(1 as int), cast(2 as smallint)) FROM t +-- !query 41 schema +struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS SMALLINT) AS INT))):int> +-- !query 41 output +1 + + +-- !query 42 +SELECT IF(true, cast(1 as int), cast(2 as short)) FROM t +-- !query 42 schema +struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS SMALLINT) AS INT))):int> +-- !query 42 output +1 + + +-- !query 43 +SELECT IF(true, cast(1 as int), cast(2 as int)) FROM t +-- !query 43 schema +struct<(IF(true, CAST(1 AS INT), CAST(2 AS INT))):int> +-- !query 43 output +1 + + +-- !query 44 +SELECT IF(true, cast(1 as int), cast(2 as bigint)) FROM t +-- !query 44 schema +struct<(IF(true, CAST(CAST(1 AS INT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +-- !query 44 output +1 + + +-- !query 45 +SELECT IF(true, cast(1 as int), cast(2 as float)) FROM t +-- !query 45 schema +struct<(IF(true, CAST(CAST(1 AS INT) AS FLOAT), CAST(2 AS FLOAT))):float> +-- !query 45 output +1.0 + + +-- !query 46 +SELECT IF(true, cast(1 as int), cast(2 as double)) FROM t +-- !query 46 schema +struct<(IF(true, CAST(CAST(1 AS INT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 46 output +1.0 + + +-- !query 47 +SELECT IF(true, cast(1 as int), cast(2 as decimal(10, 0))) FROM t +-- !query 47 schema +struct<(IF(true, CAST(CAST(1 AS INT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 47 output +1 + + +-- !query 48 +SELECT IF(true, cast(1 as int), cast(2 as string)) FROM t +-- !query 48 schema +struct<(IF(true, CAST(CAST(1 AS INT) AS STRING), CAST(2 AS STRING))):string> +-- !query 48 output +1 + + +-- !query 49 +SELECT IF(true, cast(1 as int), cast('2' as binary)) FROM t +-- !query 49 schema +struct<> +-- !query 49 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS INT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2' AS BINARY)))' (int and binary).; line 1 pos 7 + + +-- !query 50 +SELECT IF(true, cast(1 as int), cast(2 as boolean)) FROM t +-- !query 50 schema +struct<> +-- !query 50 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS INT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST(2 AS BOOLEAN)))' (int and boolean).; line 1 pos 7 + + +-- !query 51 +SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 51 schema +struct<> +-- !query 51 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (int and timestamp).; line 1 pos 7 + + +-- !query 52 +SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 52 schema +struct<> +-- !query 52 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00' AS DATE)))' (int and date).; line 1 pos 7 + + +-- !query 53 +SELECT IF(true, cast(1 as bigint), cast(2 as tinyint)) FROM t +-- !query 53 schema +struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS TINYINT) AS BIGINT))):bigint> +-- !query 53 output +1 + + +-- !query 54 +SELECT IF(true, cast(1 as bigint), cast(2 as smallint)) FROM t +-- !query 54 schema +struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS SMALLINT) AS BIGINT))):bigint> +-- !query 54 output +1 + + +-- !query 55 +SELECT IF(true, cast(1 as bigint), cast(2 as short)) FROM t +-- !query 55 schema +struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS SMALLINT) AS BIGINT))):bigint> +-- !query 55 output +1 + + +-- !query 56 +SELECT IF(true, cast(1 as bigint), cast(2 as int)) FROM t +-- !query 56 schema +struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS INT) AS BIGINT))):bigint> +-- !query 56 output +1 + + +-- !query 57 +SELECT IF(true, cast(1 as bigint), cast(2 as bigint)) FROM t +-- !query 57 schema +struct<(IF(true, CAST(1 AS BIGINT), CAST(2 AS BIGINT))):bigint> +-- !query 57 output +1 + + +-- !query 58 +SELECT IF(true, cast(1 as bigint), cast(2 as float)) FROM t +-- !query 58 schema +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS FLOAT), CAST(2 AS FLOAT))):float> +-- !query 58 output +1.0 + + +-- !query 59 +SELECT IF(true, cast(1 as bigint), cast(2 as double)) FROM t +-- !query 59 schema +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 59 output +1.0 + + +-- !query 60 +SELECT IF(true, cast(1 as bigint), cast(2 as decimal(10, 0))) FROM t +-- !query 60 schema +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS DECIMAL(20,0)), CAST(CAST(2 AS DECIMAL(10,0)) AS DECIMAL(20,0)))):decimal(20,0)> +-- !query 60 output +1 + + +-- !query 61 +SELECT IF(true, cast(1 as bigint), cast(2 as string)) FROM t +-- !query 61 schema +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS STRING), CAST(2 AS STRING))):string> +-- !query 61 output +1 + + +-- !query 62 +SELECT IF(true, cast(1 as bigint), cast('2' as binary)) FROM t +-- !query 62 schema +struct<> +-- !query 62 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2' AS BINARY)))' (bigint and binary).; line 1 pos 7 + + +-- !query 63 +SELECT IF(true, cast(1 as bigint), cast(2 as boolean)) FROM t +-- !query 63 schema +struct<> +-- !query 63 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST(2 AS BOOLEAN)))' (bigint and boolean).; line 1 pos 7 + + +-- !query 64 +SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 64 schema +struct<> +-- !query 64 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (bigint and timestamp).; line 1 pos 7 + + +-- !query 65 +SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 65 schema +struct<> +-- !query 65 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00' AS DATE)))' (bigint and date).; line 1 pos 7 + + +-- !query 66 +SELECT IF(true, cast(1 as float), cast(2 as tinyint)) FROM t +-- !query 66 schema +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS TINYINT) AS FLOAT))):float> +-- !query 66 output +1.0 + + +-- !query 67 +SELECT IF(true, cast(1 as float), cast(2 as smallint)) FROM t +-- !query 67 schema +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS SMALLINT) AS FLOAT))):float> +-- !query 67 output +1.0 + + +-- !query 68 +SELECT IF(true, cast(1 as float), cast(2 as short)) FROM t +-- !query 68 schema +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS SMALLINT) AS FLOAT))):float> +-- !query 68 output +1.0 + + +-- !query 69 +SELECT IF(true, cast(1 as float), cast(2 as int)) FROM t +-- !query 69 schema +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS INT) AS FLOAT))):float> +-- !query 69 output +1.0 + + +-- !query 70 +SELECT IF(true, cast(1 as float), cast(2 as bigint)) FROM t +-- !query 70 schema +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS BIGINT) AS FLOAT))):float> +-- !query 70 output +1.0 + + +-- !query 71 +SELECT IF(true, cast(1 as float), cast(2 as float)) FROM t +-- !query 71 schema +struct<(IF(true, CAST(1 AS FLOAT), CAST(2 AS FLOAT))):float> +-- !query 71 output +1.0 + + +-- !query 72 +SELECT IF(true, cast(1 as float), cast(2 as double)) FROM t +-- !query 72 schema +struct<(IF(true, CAST(CAST(1 AS FLOAT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 72 output +1.0 + + +-- !query 73 +SELECT IF(true, cast(1 as float), cast(2 as decimal(10, 0))) FROM t +-- !query 73 schema +struct<(IF(true, CAST(CAST(1 AS FLOAT) AS DOUBLE), CAST(CAST(2 AS DECIMAL(10,0)) AS DOUBLE))):double> +-- !query 73 output +1.0 + + +-- !query 74 +SELECT IF(true, cast(1 as float), cast(2 as string)) FROM t +-- !query 74 schema +struct<(IF(true, CAST(CAST(1 AS FLOAT) AS STRING), CAST(2 AS STRING))):string> +-- !query 74 output +1.0 + + +-- !query 75 +SELECT IF(true, cast(1 as float), cast('2' as binary)) FROM t +-- !query 75 schema +struct<> +-- !query 75 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST('2' AS BINARY)))' (float and binary).; line 1 pos 7 + + +-- !query 76 +SELECT IF(true, cast(1 as float), cast(2 as boolean)) FROM t +-- !query 76 schema +struct<> +-- !query 76 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST(2 AS BOOLEAN)))' (float and boolean).; line 1 pos 7 + + +-- !query 77 +SELECT IF(true, cast(1 as float), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 77 schema +struct<> +-- !query 77 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (float and timestamp).; line 1 pos 7 + + +-- !query 78 +SELECT IF(true, cast(1 as float), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 78 schema +struct<> +-- !query 78 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00' AS DATE)))' (float and date).; line 1 pos 7 + + +-- !query 79 +SELECT IF(true, cast(1 as double), cast(2 as tinyint)) FROM t +-- !query 79 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS TINYINT) AS DOUBLE))):double> +-- !query 79 output +1.0 + + +-- !query 80 +SELECT IF(true, cast(1 as double), cast(2 as smallint)) FROM t +-- !query 80 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS SMALLINT) AS DOUBLE))):double> +-- !query 80 output +1.0 + + +-- !query 81 +SELECT IF(true, cast(1 as double), cast(2 as short)) FROM t +-- !query 81 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS SMALLINT) AS DOUBLE))):double> +-- !query 81 output +1.0 + + +-- !query 82 +SELECT IF(true, cast(1 as double), cast(2 as int)) FROM t +-- !query 82 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS INT) AS DOUBLE))):double> +-- !query 82 output +1.0 + + +-- !query 83 +SELECT IF(true, cast(1 as double), cast(2 as bigint)) FROM t +-- !query 83 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS BIGINT) AS DOUBLE))):double> +-- !query 83 output +1.0 + + +-- !query 84 +SELECT IF(true, cast(1 as double), cast(2 as float)) FROM t +-- !query 84 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS FLOAT) AS DOUBLE))):double> +-- !query 84 output +1.0 + + +-- !query 85 +SELECT IF(true, cast(1 as double), cast(2 as double)) FROM t +-- !query 85 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 85 output +1.0 + + +-- !query 86 +SELECT IF(true, cast(1 as double), cast(2 as decimal(10, 0))) FROM t +-- !query 86 schema +struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS DECIMAL(10,0)) AS DOUBLE))):double> +-- !query 86 output +1.0 + + +-- !query 87 +SELECT IF(true, cast(1 as double), cast(2 as string)) FROM t +-- !query 87 schema +struct<(IF(true, CAST(CAST(1 AS DOUBLE) AS STRING), CAST(2 AS STRING))):string> +-- !query 87 output +1.0 + + +-- !query 88 +SELECT IF(true, cast(1 as double), cast('2' as binary)) FROM t +-- !query 88 schema +struct<> +-- !query 88 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST('2' AS BINARY)))' (double and binary).; line 1 pos 7 + + +-- !query 89 +SELECT IF(true, cast(1 as double), cast(2 as boolean)) FROM t +-- !query 89 schema +struct<> +-- !query 89 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST(2 AS BOOLEAN)))' (double and boolean).; line 1 pos 7 + + +-- !query 90 +SELECT IF(true, cast(1 as double), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 90 schema +struct<> +-- !query 90 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (double and timestamp).; line 1 pos 7 + + +-- !query 91 +SELECT IF(true, cast(1 as double), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 91 schema +struct<> +-- !query 91 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00' AS DATE)))' (double and date).; line 1 pos 7 + + +-- !query 92 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as tinyint)) FROM t +-- !query 92 schema +struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS TINYINT) AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 92 output +1 + + +-- !query 93 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as smallint)) FROM t +-- !query 93 schema +struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS SMALLINT) AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 93 output +1 + + +-- !query 94 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as short)) FROM t +-- !query 94 schema +struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS SMALLINT) AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 94 output +1 + + +-- !query 95 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as int)) FROM t +-- !query 95 schema +struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS INT) AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 95 output +1 + + +-- !query 96 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as bigint)) FROM t +-- !query 96 schema +struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(20,0)), CAST(CAST(2 AS BIGINT) AS DECIMAL(20,0)))):decimal(20,0)> +-- !query 96 output +1 + + +-- !query 97 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as float)) FROM t +-- !query 97 schema +struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE), CAST(CAST(2 AS FLOAT) AS DOUBLE))):double> +-- !query 97 output +1.0 + + +-- !query 98 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as double)) FROM t +-- !query 98 schema +struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE), CAST(2 AS DOUBLE))):double> +-- !query 98 output +1.0 + + +-- !query 99 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as decimal(10, 0))) FROM t +-- !query 99 schema +struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +-- !query 99 output +1 + + +-- !query 100 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as string)) FROM t +-- !query 100 schema +struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS STRING), CAST(2 AS STRING))):string> +-- !query 100 output +1 + + +-- !query 101 +SELECT IF(true, cast(1 as decimal(10, 0)), cast('2' as binary)) FROM t +-- !query 101 schema +struct<> +-- !query 101 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2' AS BINARY)))' (decimal(10,0) and binary).; line 1 pos 7 + + +-- !query 102 +SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as boolean)) FROM t +-- !query 102 schema +struct<> +-- !query 102 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(2 AS BOOLEAN)))' (decimal(10,0) and boolean).; line 1 pos 7 + + +-- !query 103 +SELECT IF(true, cast(1 as decimal(10, 0)), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 103 schema +struct<> +-- !query 103 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, 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 104 +SELECT IF(true, cast(1 as decimal(10, 0)), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 104 schema +struct<> +-- !query 104 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, 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 105 +SELECT IF(true, cast(1 as string), cast(2 as tinyint)) FROM t +-- !query 105 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS TINYINT) AS STRING))):string> +-- !query 105 output +1 + + +-- !query 106 +SELECT IF(true, cast(1 as string), cast(2 as smallint)) FROM t +-- !query 106 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS SMALLINT) AS STRING))):string> +-- !query 106 output +1 + + +-- !query 107 +SELECT IF(true, cast(1 as string), cast(2 as short)) FROM t +-- !query 107 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS SMALLINT) AS STRING))):string> +-- !query 107 output +1 + + +-- !query 108 +SELECT IF(true, cast(1 as string), cast(2 as int)) FROM t +-- !query 108 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS INT) AS STRING))):string> +-- !query 108 output +1 + + +-- !query 109 +SELECT IF(true, cast(1 as string), cast(2 as bigint)) FROM t +-- !query 109 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS BIGINT) AS STRING))):string> +-- !query 109 output +1 + + +-- !query 110 +SELECT IF(true, cast(1 as string), cast(2 as float)) FROM t +-- !query 110 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS FLOAT) AS STRING))):string> +-- !query 110 output +1 + + +-- !query 111 +SELECT IF(true, cast(1 as string), cast(2 as double)) FROM t +-- !query 111 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS DOUBLE) AS STRING))):string> +-- !query 111 output +1 + + +-- !query 112 +SELECT IF(true, cast(1 as string), cast(2 as decimal(10, 0))) FROM t +-- !query 112 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS DECIMAL(10,0)) AS STRING))):string> +-- !query 112 output +1 + + +-- !query 113 +SELECT IF(true, cast(1 as string), cast(2 as string)) FROM t +-- !query 113 schema +struct<(IF(true, CAST(1 AS STRING), CAST(2 AS STRING))):string> +-- !query 113 output +1 + + +-- !query 114 +SELECT IF(true, cast(1 as string), cast('2' as binary)) FROM t +-- !query 114 schema +struct<> +-- !query 114 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS STRING), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS STRING), CAST('2' AS BINARY)))' (string and binary).; line 1 pos 7 + + +-- !query 115 +SELECT IF(true, cast(1 as string), cast(2 as boolean)) FROM t +-- !query 115 schema +struct<> +-- !query 115 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS STRING), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS STRING), CAST(2 AS BOOLEAN)))' (string and boolean).; line 1 pos 7 + + +-- !query 116 +SELECT IF(true, cast(1 as string), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 116 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2017-12-11 09:30:00.0 AS TIMESTAMP) AS STRING))):string> +-- !query 116 output +1 + + +-- !query 117 +SELECT IF(true, cast(1 as string), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 117 schema +struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2017-12-11 09:30:00 AS DATE) AS STRING))):string> +-- !query 117 output +1 + + +-- !query 118 +SELECT IF(true, cast('1' as binary), cast(2 as tinyint)) FROM t +-- !query 118 schema +struct<> +-- !query 118 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS TINYINT)))' (binary and tinyint).; line 1 pos 7 + + +-- !query 119 +SELECT IF(true, cast('1' as binary), cast(2 as smallint)) FROM t +-- !query 119 schema +struct<> +-- !query 119 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' (binary and smallint).; line 1 pos 7 + + +-- !query 120 +SELECT IF(true, cast('1' as binary), cast(2 as short)) FROM t +-- !query 120 schema +struct<> +-- !query 120 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' (binary and smallint).; line 1 pos 7 + + +-- !query 121 +SELECT IF(true, cast('1' as binary), cast(2 as int)) FROM t +-- !query 121 schema +struct<> +-- !query 121 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS INT)))' (binary and int).; line 1 pos 7 + + +-- !query 122 +SELECT IF(true, cast('1' as binary), cast(2 as bigint)) FROM t +-- !query 122 schema +struct<> +-- !query 122 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS BIGINT)))' (binary and bigint).; line 1 pos 7 + + +-- !query 123 +SELECT IF(true, cast('1' as binary), cast(2 as float)) FROM t +-- !query 123 schema +struct<> +-- !query 123 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS FLOAT)))' (binary and float).; line 1 pos 7 + + +-- !query 124 +SELECT IF(true, cast('1' as binary), cast(2 as double)) FROM t +-- !query 124 schema +struct<> +-- !query 124 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS DOUBLE)))' (binary and double).; line 1 pos 7 + + +-- !query 125 +SELECT IF(true, cast('1' as binary), cast(2 as decimal(10, 0))) FROM t +-- !query 125 schema +struct<> +-- !query 125 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS DECIMAL(10,0))))' (binary and decimal(10,0)).; line 1 pos 7 + + +-- !query 126 +SELECT IF(true, cast('1' as binary), cast(2 as string)) FROM t +-- !query 126 schema +struct<> +-- !query 126 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS STRING)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS STRING)))' (binary and string).; line 1 pos 7 + + +-- !query 127 +SELECT IF(true, cast('1' as binary), cast('2' as binary)) FROM t +-- !query 127 schema +struct<(IF(true, CAST(1 AS BINARY), CAST(2 AS BINARY))):binary> +-- !query 127 output +1 + + +-- !query 128 +SELECT IF(true, cast('1' as binary), cast(2 as boolean)) FROM t +-- !query 128 schema +struct<> +-- !query 128 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS BOOLEAN)))' (binary and boolean).; line 1 pos 7 + + +-- !query 129 +SELECT IF(true, cast('1' as binary), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 129 schema +struct<> +-- !query 129 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (binary and timestamp).; line 1 pos 7 + + +-- !query 130 +SELECT IF(true, cast('1' as binary), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 130 schema +struct<> +-- !query 130 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00' AS DATE)))' (binary and date).; line 1 pos 7 + + +-- !query 131 +SELECT IF(true, cast(1 as boolean), cast(2 as tinyint)) FROM t +-- !query 131 schema +struct<> +-- !query 131 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS TINYINT)))' (boolean and tinyint).; line 1 pos 7 + + +-- !query 132 +SELECT IF(true, cast(1 as boolean), cast(2 as smallint)) FROM t +-- !query 132 schema +struct<> +-- !query 132 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' (boolean and smallint).; line 1 pos 7 + + +-- !query 133 +SELECT IF(true, cast(1 as boolean), cast(2 as short)) FROM t +-- !query 133 schema +struct<> +-- !query 133 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' (boolean and smallint).; line 1 pos 7 + + +-- !query 134 +SELECT IF(true, cast(1 as boolean), cast(2 as int)) FROM t +-- !query 134 schema +struct<> +-- !query 134 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS INT)))' (boolean and int).; line 1 pos 7 + + +-- !query 135 +SELECT IF(true, cast(1 as boolean), cast(2 as bigint)) FROM t +-- !query 135 schema +struct<> +-- !query 135 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS BIGINT)))' (boolean and bigint).; line 1 pos 7 + + +-- !query 136 +SELECT IF(true, cast(1 as boolean), cast(2 as float)) FROM t +-- !query 136 schema +struct<> +-- !query 136 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS FLOAT)))' (boolean and float).; line 1 pos 7 + + +-- !query 137 +SELECT IF(true, cast(1 as boolean), cast(2 as double)) FROM t +-- !query 137 schema +struct<> +-- !query 137 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DOUBLE)))' (boolean and double).; line 1 pos 7 + + +-- !query 138 +SELECT IF(true, cast(1 as boolean), cast(2 as decimal(10, 0))) FROM t +-- !query 138 schema +struct<> +-- !query 138 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DECIMAL(10,0))))' (boolean and decimal(10,0)).; line 1 pos 7 + + +-- !query 139 +SELECT IF(true, cast(1 as boolean), cast(2 as string)) FROM t +-- !query 139 schema +struct<> +-- !query 139 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS STRING)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS STRING)))' (boolean and string).; line 1 pos 7 + + +-- !query 140 +SELECT IF(true, cast(1 as boolean), cast('2' as binary)) FROM t +-- !query 140 schema +struct<> +-- !query 140 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST('2' AS BINARY)))' (boolean and binary).; line 1 pos 7 + + +-- !query 141 +SELECT IF(true, cast(1 as boolean), cast(2 as boolean)) FROM t +-- !query 141 schema +struct<(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS BOOLEAN))):boolean> +-- !query 141 output +true + + +-- !query 142 +SELECT IF(true, cast(1 as boolean), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 142 schema +struct<> +-- !query 142 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (boolean and timestamp).; line 1 pos 7 + + +-- !query 143 +SELECT IF(true, cast(1 as boolean), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 143 schema +struct<> +-- !query 143 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00' AS DATE)))' (boolean and date).; line 1 pos 7 + + +-- !query 144 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as tinyint)) FROM t +-- !query 144 schema +struct<> +-- !query 144 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS TINYINT)))' (timestamp and tinyint).; line 1 pos 7 + + +-- !query 145 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as smallint)) FROM t +-- !query 145 schema +struct<> +-- !query 145 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' (timestamp and smallint).; line 1 pos 7 + + +-- !query 146 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as short)) FROM t +-- !query 146 schema +struct<> +-- !query 146 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' (timestamp and smallint).; line 1 pos 7 + + +-- !query 147 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as int)) FROM t +-- !query 147 schema +struct<> +-- !query 147 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS INT)))' (timestamp and int).; line 1 pos 7 + + +-- !query 148 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as bigint)) FROM t +-- !query 148 schema +struct<> +-- !query 148 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BIGINT)))' (timestamp and bigint).; line 1 pos 7 + + +-- !query 149 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as float)) FROM t +-- !query 149 schema +struct<> +-- !query 149 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS FLOAT)))' (timestamp and float).; line 1 pos 7 + + +-- !query 150 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as double)) FROM t +-- !query 150 schema +struct<> +-- !query 150 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DOUBLE)))' (timestamp and double).; line 1 pos 7 + + +-- !query 151 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as decimal(10, 0))) FROM t +-- !query 151 schema +struct<> +-- !query 151 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DECIMAL(10,0))))' (timestamp and decimal(10,0)).; line 1 pos 7 + + +-- !query 152 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as string)) FROM t +-- !query 152 schema +struct<(IF(true, CAST(CAST(2017-12-12 09:30:00.0 AS TIMESTAMP) AS STRING), CAST(2 AS STRING))):string> +-- !query 152 output +2017-12-12 09:30:00 + + +-- !query 153 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2' as binary)) FROM t +-- !query 153 schema +struct<> +-- !query 153 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST('2' AS BINARY)))' (timestamp and binary).; line 1 pos 7 + + +-- !query 154 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as boolean)) FROM t +-- !query 154 schema +struct<> +-- !query 154 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BOOLEAN)))' (timestamp and boolean).; line 1 pos 7 + + +-- !query 155 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 155 schema +struct<(IF(true, CAST(2017-12-12 09:30:00.0 AS TIMESTAMP), CAST(2017-12-11 09:30:00.0 AS TIMESTAMP))):timestamp> +-- !query 155 output +2017-12-12 09:30:00 + + +-- !query 156 +SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 156 schema +struct<(IF(true, CAST(2017-12-12 09:30:00.0 AS TIMESTAMP), CAST(CAST(2017-12-11 09:30:00 AS DATE) AS TIMESTAMP))):timestamp> +-- !query 156 output +2017-12-12 09:30:00 + + +-- !query 157 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as tinyint)) FROM t +-- !query 157 schema +struct<> +-- !query 157 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS TINYINT)))' (date and tinyint).; line 1 pos 7 + + +-- !query 158 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as smallint)) FROM t +-- !query 158 schema +struct<> +-- !query 158 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' (date and smallint).; line 1 pos 7 + + +-- !query 159 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as short)) FROM t +-- !query 159 schema +struct<> +-- !query 159 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' (date and smallint).; line 1 pos 7 + + +-- !query 160 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as int)) FROM t +-- !query 160 schema +struct<> +-- !query 160 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS INT)))' (date and int).; line 1 pos 7 + + +-- !query 161 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as bigint)) FROM t +-- !query 161 schema +struct<> +-- !query 161 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BIGINT)))' (date and bigint).; line 1 pos 7 + + +-- !query 162 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as float)) FROM t +-- !query 162 schema +struct<> +-- !query 162 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS FLOAT)))' (date and float).; line 1 pos 7 + + +-- !query 163 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as double)) FROM t +-- !query 163 schema +struct<> +-- !query 163 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DOUBLE)))' (date and double).; line 1 pos 7 + + +-- !query 164 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as decimal(10, 0))) FROM t +-- !query 164 schema +struct<> +-- !query 164 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DECIMAL(10,0))))' (date and decimal(10,0)).; line 1 pos 7 + + +-- !query 165 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as string)) FROM t +-- !query 165 schema +struct<(IF(true, CAST(CAST(2017-12-12 09:30:00 AS DATE) AS STRING), CAST(2 AS STRING))):string> +-- !query 165 output +2017-12-12 + + +-- !query 166 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2' as binary)) FROM t +-- !query 166 schema +struct<> +-- !query 166 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST('2' AS BINARY)))' (date and binary).; line 1 pos 7 + + +-- !query 167 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as boolean)) FROM t +-- !query 167 schema +struct<> +-- !query 167 output +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BOOLEAN)))' (date and boolean).; line 1 pos 7 + + +-- !query 168 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +-- !query 168 schema +struct<(IF(true, CAST(CAST(2017-12-12 09:30:00 AS DATE) AS TIMESTAMP), CAST(2017-12-11 09:30:00.0 AS TIMESTAMP))):timestamp> +-- !query 168 output +2017-12-12 00:00:00 + + +-- !query 169 +SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2017-12-11 09:30:00' as date)) FROM t +-- !query 169 schema +struct<(IF(true, CAST(2017-12-12 09:30:00 AS DATE), CAST(2017-12-11 09:30:00 AS DATE))):date> +-- !query 169 output +2017-12-12 From 8d0472034e9267f7a6758b2ee9527f226e8f823e Mon Sep 17 00:00:00 2001 From: Yuming Wang Date: Fri, 15 Dec 2017 13:50:26 +0800 Subject: [PATCH 2/2] Remove short --- .../typeCoercion/native/caseWhenCoercion.sql | 26 - .../inputs/typeCoercion/native/ifCoercion.sql | 26 - .../native/caseWhenCoercion.sql.out | 1042 +++++++---------- .../typeCoercion/native/ifCoercion.sql.out | 1042 +++++++---------- 4 files changed, 834 insertions(+), 1302 deletions(-) diff --git a/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql index d3c19fb45a1c4..a780529fdca8c 100644 --- a/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql +++ b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/caseWhenCoercion.sql @@ -19,7 +19,6 @@ CREATE TEMPORARY VIEW t AS SELECT 1; SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as float) END FROM t; @@ -33,7 +32,6 @@ SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00' as SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as float) END FROM t; @@ -45,23 +43,8 @@ SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as boolean) END FROM SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as tinyint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as short) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as int) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as bigint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as float) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as double) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as decimal(10, 0)) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as string) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2' as binary) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as boolean) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t; -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00' as date) END FROM t; - SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as float) END FROM t; @@ -75,7 +58,6 @@ SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00' as dat SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as float) END FROM t; @@ -89,7 +71,6 @@ SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00' as SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as float) END FROM t; @@ -103,7 +84,6 @@ SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2017-12-11 09:30:00' as d SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as float) END FROM t; @@ -117,7 +97,6 @@ SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2017-12-11 09:30:00' as SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as float) END FROM t; @@ -131,7 +110,6 @@ SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2017-12-11 09:30 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as float) END FROM t; @@ -145,7 +123,6 @@ SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2017-12-11 09:30:00' as SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as float) END FROM t; @@ -159,7 +136,6 @@ SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2017-12-11 09:30:00' a SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as float) END FROM t; @@ -173,7 +149,6 @@ SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2017-12-11 09:30:00' as SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as float) END FROM t; @@ -187,7 +162,6 @@ SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast( SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as tinyint) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as smallint) END FROM t; -SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as short) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as int) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as bigint) END FROM t; SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as float) END FROM t; diff --git a/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql index 764419bfca37b..42597f169daec 100644 --- a/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql +++ b/sql/core/src/test/resources/sql-tests/inputs/typeCoercion/native/ifCoercion.sql @@ -19,7 +19,6 @@ CREATE TEMPORARY VIEW t AS SELECT 1; SELECT IF(true, cast(1 as tinyint), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as tinyint), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as tinyint), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as tinyint), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as tinyint), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as tinyint), cast(2 as float)) FROM t; @@ -33,7 +32,6 @@ SELECT IF(true, cast(1 as tinyint), cast('2017-12-11 09:30:00' as date)) FROM t; SELECT IF(true, cast(1 as smallint), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as smallint), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as smallint), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as smallint), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as smallint), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as smallint), cast(2 as float)) FROM t; @@ -45,23 +43,8 @@ SELECT IF(true, cast(1 as smallint), cast(2 as boolean)) FROM t; SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00' as date)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as tinyint)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as short)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as int)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as bigint)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as float)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as double)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as decimal(10, 0))) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as string)) FROM t; -SELECT IF(true, cast(1 as short), cast('2' as binary)) FROM t; -SELECT IF(true, cast(1 as short), cast(2 as boolean)) FROM t; -SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t; -SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00' as date)) FROM t; - SELECT IF(true, cast(1 as int), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as int), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as int), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as int), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as int), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as int), cast(2 as float)) FROM t; @@ -75,7 +58,6 @@ SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00' as date)) FROM t; SELECT IF(true, cast(1 as bigint), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as bigint), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as bigint), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as bigint), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as bigint), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as bigint), cast(2 as float)) FROM t; @@ -89,7 +71,6 @@ SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00' as date)) FROM t; SELECT IF(true, cast(1 as float), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as float), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as float), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as float), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as float), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as float), cast(2 as float)) FROM t; @@ -103,7 +84,6 @@ SELECT IF(true, cast(1 as float), cast('2017-12-11 09:30:00' as date)) FROM t; SELECT IF(true, cast(1 as double), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as double), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as double), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as double), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as double), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as double), cast(2 as float)) FROM t; @@ -117,7 +97,6 @@ SELECT IF(true, cast(1 as double), cast('2017-12-11 09:30:00' as date)) FROM t; SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as float)) FROM t; @@ -131,7 +110,6 @@ SELECT IF(true, cast(1 as decimal(10, 0)), cast('2017-12-11 09:30:00' as date)) SELECT IF(true, cast(1 as string), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as string), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as string), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as string), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as string), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as string), cast(2 as float)) FROM t; @@ -145,7 +123,6 @@ SELECT IF(true, cast(1 as string), cast('2017-12-11 09:30:00' as date)) FROM t; SELECT IF(true, cast('1' as binary), cast(2 as tinyint)) FROM t; SELECT IF(true, cast('1' as binary), cast(2 as smallint)) FROM t; -SELECT IF(true, cast('1' as binary), cast(2 as short)) FROM t; SELECT IF(true, cast('1' as binary), cast(2 as int)) FROM t; SELECT IF(true, cast('1' as binary), cast(2 as bigint)) FROM t; SELECT IF(true, cast('1' as binary), cast(2 as float)) FROM t; @@ -159,7 +136,6 @@ SELECT IF(true, cast('1' as binary), cast('2017-12-11 09:30:00' as date)) FROM t SELECT IF(true, cast(1 as boolean), cast(2 as tinyint)) FROM t; SELECT IF(true, cast(1 as boolean), cast(2 as smallint)) FROM t; -SELECT IF(true, cast(1 as boolean), cast(2 as short)) FROM t; SELECT IF(true, cast(1 as boolean), cast(2 as int)) FROM t; SELECT IF(true, cast(1 as boolean), cast(2 as bigint)) FROM t; SELECT IF(true, cast(1 as boolean), cast(2 as float)) FROM t; @@ -173,7 +149,6 @@ SELECT IF(true, cast(1 as boolean), cast('2017-12-11 09:30:00' as date)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as tinyint)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as smallint)) FROM t; -SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as short)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as int)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as bigint)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as float)) FROM t; @@ -187,7 +162,6 @@ SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2017-12-11 09: SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as tinyint)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as smallint)) FROM t; -SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as short)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as int)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as bigint)) FROM t; SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as float)) FROM t; diff --git a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out index 2422a1838d241..a739f8d73181c 100644 --- a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/caseWhenCoercion.sql.out @@ -1,5 +1,5 @@ -- Automatically generated by SQLQueryTestSuite --- Number of queries: 170 +-- Number of queries: 145 -- !query 0 @@ -27,1414 +27,1206 @@ struct +struct -- !query 3 output 1 -- !query 4 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as int) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as bigint) END FROM t -- !query 4 schema -struct +struct -- !query 4 output 1 -- !query 5 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as bigint) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as float) END FROM t -- !query 5 schema -struct +struct -- !query 5 output -1 +1.0 -- !query 6 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as float) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as double) END FROM t -- !query 6 schema -struct +struct -- !query 6 output 1.0 -- !query 7 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as double) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as decimal(10, 0)) END FROM t -- !query 7 schema -struct +struct -- !query 7 output -1.0 +1 -- !query 8 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as decimal(10, 0)) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as string) END FROM t -- !query 8 schema -struct +struct -- !query 8 output 1 -- !query 9 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as string) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2' as binary) END FROM t -- !query 9 schema -struct +struct<> -- !query 9 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 10 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2' as binary) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as boolean) END FROM t -- !query 10 schema struct<> -- !query 10 output org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 11 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast(2 as boolean) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t -- !query 11 schema struct<> -- !query 11 output org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 12 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t -- !query 12 schema struct<> -- !query 12 output org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 13 -SELECT CASE WHEN true THEN cast(1 as tinyint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as tinyint) END FROM t -- !query 13 schema -struct<> +struct -- !query 13 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS TINYINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1 -- !query 14 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as tinyint) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as smallint) END FROM t -- !query 14 schema -struct +struct -- !query 14 output 1 -- !query 15 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as smallint) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as int) END FROM t -- !query 15 schema -struct +struct -- !query 15 output 1 -- !query 16 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as short) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as bigint) END FROM t -- !query 16 schema -struct +struct -- !query 16 output 1 -- !query 17 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as int) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as float) END FROM t -- !query 17 schema -struct +struct -- !query 17 output -1 +1.0 -- !query 18 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as bigint) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as double) END FROM t -- !query 18 schema -struct +struct -- !query 18 output -1 +1.0 -- !query 19 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as float) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as decimal(10, 0)) END FROM t -- !query 19 schema -struct +struct -- !query 19 output -1.0 +1 -- !query 20 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as double) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as string) END FROM t -- !query 20 schema -struct +struct -- !query 20 output -1.0 +1 -- !query 21 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as decimal(10, 0)) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2' as binary) END FROM t -- !query 21 schema -struct +struct<> -- !query 21 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 22 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as string) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as boolean) END FROM t -- !query 22 schema -struct +struct<> -- !query 22 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 23 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2' as binary) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t -- !query 23 schema struct<> -- !query 23 output org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 24 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast(2 as boolean) END FROM t +SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t -- !query 24 schema struct<> -- !query 24 output org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 25 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as tinyint) END FROM t -- !query 25 schema -struct<> +struct -- !query 25 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1 -- !query 26 -SELECT CASE WHEN true THEN cast(1 as smallint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as smallint) END FROM t -- !query 26 schema -struct<> +struct -- !query 26 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1 -- !query 27 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as tinyint) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as int) END FROM t -- !query 27 schema -struct +struct -- !query 27 output 1 -- !query 28 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as smallint) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as bigint) END FROM t -- !query 28 schema -struct +struct -- !query 28 output 1 -- !query 29 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as short) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as float) END FROM t -- !query 29 schema -struct +struct -- !query 29 output -1 +1.0 -- !query 30 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as int) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as double) END FROM t -- !query 30 schema -struct +struct -- !query 30 output -1 +1.0 -- !query 31 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as bigint) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as decimal(10, 0)) END FROM t -- !query 31 schema -struct +struct -- !query 31 output 1 -- !query 32 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as float) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as string) END FROM t -- !query 32 schema -struct +struct -- !query 32 output -1.0 +1 -- !query 33 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as double) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2' as binary) END FROM t -- !query 33 schema -struct +struct<> -- !query 33 output -1.0 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 34 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as decimal(10, 0)) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as boolean) END FROM t -- !query 34 schema -struct +struct<> -- !query 34 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 35 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as string) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t -- !query 35 schema -struct +struct<> -- !query 35 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 36 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2' as binary) END FROM t +SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00' as date) END FROM t -- !query 36 schema struct<> -- !query 36 output org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 37 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast(2 as boolean) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as tinyint) END FROM t -- !query 37 schema -struct<> +struct -- !query 37 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1 -- !query 38 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as smallint) END FROM t -- !query 38 schema -struct<> +struct -- !query 38 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1 -- !query 39 -SELECT CASE WHEN true THEN cast(1 as short) ELSE cast('2017-12-11 09:30:00' as date) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as int) END FROM t -- !query 39 schema -struct<> +struct -- !query 39 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS SMALLINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1 -- !query 40 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as tinyint) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as bigint) END FROM t -- !query 40 schema -struct +struct -- !query 40 output 1 -- !query 41 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as smallint) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as float) END FROM t -- !query 41 schema -struct +struct -- !query 41 output -1 +1.0 -- !query 42 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as short) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as double) END FROM t -- !query 42 schema -struct +struct -- !query 42 output -1 +1.0 -- !query 43 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as int) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as decimal(10, 0)) END FROM t -- !query 43 schema -struct +struct -- !query 43 output 1 -- !query 44 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as bigint) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as string) END FROM t -- !query 44 schema -struct +struct -- !query 44 output 1 -- !query 45 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as float) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2' as binary) END FROM t -- !query 45 schema -struct +struct<> -- !query 45 output -1.0 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 46 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as double) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as boolean) END FROM t -- !query 46 schema -struct +struct<> -- !query 46 output -1.0 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 47 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as decimal(10, 0)) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t -- !query 47 schema -struct +struct<> -- !query 47 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 48 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as string) END FROM t +SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t -- !query 48 schema -struct +struct<> -- !query 48 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 -- !query 49 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2' as binary) END FROM t +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as tinyint) END FROM t -- !query 49 schema -struct<> +struct -- !query 49 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1.0 -- !query 50 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast(2 as boolean) END FROM t +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as smallint) END FROM t -- !query 50 schema -struct<> +struct -- !query 50 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 +1.0 -- !query 51 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t +SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as int) END FROM t -- !query 51 schema -struct<> +struct -- !query 51 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 52 -SELECT CASE WHEN true THEN cast(1 as int) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 52 schema -struct<> --- !query 52 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS INT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 53 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as tinyint) END FROM t --- !query 53 schema -struct --- !query 53 output -1 - - --- !query 54 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as smallint) END FROM t --- !query 54 schema -struct --- !query 54 output -1 - - --- !query 55 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as short) END FROM t --- !query 55 schema -struct --- !query 55 output -1 - - --- !query 56 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as int) END FROM t --- !query 56 schema -struct --- !query 56 output -1 - - --- !query 57 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as bigint) END FROM t --- !query 57 schema -struct --- !query 57 output -1 - - --- !query 58 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as float) END FROM t --- !query 58 schema -struct --- !query 58 output -1.0 - - --- !query 59 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as double) END FROM t --- !query 59 schema -struct --- !query 59 output -1.0 - - --- !query 60 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 60 schema -struct --- !query 60 output -1 - - --- !query 61 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as string) END FROM t --- !query 61 schema -struct --- !query 61 output -1 - - --- !query 62 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2' as binary) END FROM t --- !query 62 schema -struct<> --- !query 62 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 63 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast(2 as boolean) END FROM t --- !query 63 schema -struct<> --- !query 63 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 64 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 64 schema -struct<> --- !query 64 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 65 -SELECT CASE WHEN true THEN cast(1 as bigint) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 65 schema -struct<> --- !query 65 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS BIGINT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 66 -SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as tinyint) END FROM t --- !query 66 schema -struct --- !query 66 output -1.0 - - --- !query 67 -SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as smallint) END FROM t --- !query 67 schema -struct --- !query 67 output -1.0 - - --- !query 68 -SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as short) END FROM t --- !query 68 schema -struct --- !query 68 output -1.0 - - --- !query 69 -SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as int) END FROM t --- !query 69 schema -struct --- !query 69 output 1.0 --- !query 70 +-- !query 52 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as bigint) END FROM t --- !query 70 schema +-- !query 52 schema struct --- !query 70 output +-- !query 52 output 1.0 --- !query 71 +-- !query 53 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as float) END FROM t --- !query 71 schema +-- !query 53 schema struct --- !query 71 output +-- !query 53 output 1.0 --- !query 72 +-- !query 54 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as double) END FROM t --- !query 72 schema +-- !query 54 schema struct --- !query 72 output +-- !query 54 output 1.0 --- !query 73 +-- !query 55 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 73 schema +-- !query 55 schema struct --- !query 73 output +-- !query 55 output 1.0 --- !query 74 +-- !query 56 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as string) END FROM t --- !query 74 schema +-- !query 56 schema struct --- !query 74 output +-- !query 56 output 1.0 --- !query 75 +-- !query 57 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2' as binary) END FROM t --- !query 75 schema +-- !query 57 schema struct<> --- !query 75 output +-- !query 57 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 76 +-- !query 58 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast(2 as boolean) END FROM t --- !query 76 schema +-- !query 58 schema struct<> --- !query 76 output +-- !query 58 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 77 +-- !query 59 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 77 schema +-- !query 59 schema struct<> --- !query 77 output +-- !query 59 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 78 +-- !query 60 SELECT CASE WHEN true THEN cast(1 as float) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 78 schema +-- !query 60 schema struct<> --- !query 78 output +-- !query 60 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS FLOAT) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 79 +-- !query 61 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as tinyint) END FROM t --- !query 79 schema +-- !query 61 schema struct --- !query 79 output +-- !query 61 output 1.0 --- !query 80 +-- !query 62 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as smallint) END FROM t --- !query 80 schema -struct --- !query 80 output -1.0 - - --- !query 81 -SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as short) END FROM t --- !query 81 schema +-- !query 62 schema struct --- !query 81 output +-- !query 62 output 1.0 --- !query 82 +-- !query 63 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as int) END FROM t --- !query 82 schema +-- !query 63 schema struct --- !query 82 output +-- !query 63 output 1.0 --- !query 83 +-- !query 64 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as bigint) END FROM t --- !query 83 schema +-- !query 64 schema struct --- !query 83 output +-- !query 64 output 1.0 --- !query 84 +-- !query 65 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as float) END FROM t --- !query 84 schema +-- !query 65 schema struct --- !query 84 output +-- !query 65 output 1.0 --- !query 85 +-- !query 66 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as double) END FROM t --- !query 85 schema +-- !query 66 schema struct --- !query 85 output +-- !query 66 output 1.0 --- !query 86 +-- !query 67 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 86 schema +-- !query 67 schema struct --- !query 86 output +-- !query 67 output 1.0 --- !query 87 +-- !query 68 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as string) END FROM t --- !query 87 schema +-- !query 68 schema struct --- !query 87 output +-- !query 68 output 1.0 --- !query 88 +-- !query 69 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2' as binary) END FROM t --- !query 88 schema +-- !query 69 schema struct<> --- !query 88 output +-- !query 69 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 89 +-- !query 70 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast(2 as boolean) END FROM t --- !query 89 schema +-- !query 70 schema struct<> --- !query 89 output +-- !query 70 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 90 +-- !query 71 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 90 schema +-- !query 71 schema struct<> --- !query 90 output +-- !query 71 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 91 +-- !query 72 SELECT CASE WHEN true THEN cast(1 as double) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 91 schema +-- !query 72 schema struct<> --- !query 91 output +-- !query 72 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DOUBLE) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 92 +-- !query 73 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as tinyint) END FROM t --- !query 92 schema +-- !query 73 schema struct --- !query 92 output +-- !query 73 output 1 --- !query 93 +-- !query 74 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as smallint) END FROM t --- !query 93 schema -struct --- !query 93 output -1 - - --- !query 94 -SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as short) END FROM t --- !query 94 schema +-- !query 74 schema struct --- !query 94 output +-- !query 74 output 1 --- !query 95 +-- !query 75 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as int) END FROM t --- !query 95 schema +-- !query 75 schema struct --- !query 95 output +-- !query 75 output 1 --- !query 96 +-- !query 76 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as bigint) END FROM t --- !query 96 schema +-- !query 76 schema struct --- !query 96 output +-- !query 76 output 1 --- !query 97 +-- !query 77 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as float) END FROM t --- !query 97 schema +-- !query 77 schema struct --- !query 97 output +-- !query 77 output 1.0 --- !query 98 +-- !query 78 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as double) END FROM t --- !query 98 schema +-- !query 78 schema struct --- !query 98 output +-- !query 78 output 1.0 --- !query 99 +-- !query 79 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 99 schema +-- !query 79 schema struct --- !query 99 output +-- !query 79 output 1 --- !query 100 +-- !query 80 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as string) END FROM t --- !query 100 schema +-- !query 80 schema struct --- !query 100 output +-- !query 80 output 1 --- !query 101 +-- !query 81 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2' as binary) END FROM t --- !query 101 schema +-- !query 81 schema struct<> --- !query 101 output +-- !query 81 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 102 +-- !query 82 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast(2 as boolean) END FROM t --- !query 102 schema +-- !query 82 schema struct<> --- !query 102 output +-- !query 82 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 103 +-- !query 83 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 103 schema +-- !query 83 schema struct<> --- !query 103 output +-- !query 83 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 104 +-- !query 84 SELECT CASE WHEN true THEN cast(1 as decimal(10, 0)) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 104 schema +-- !query 84 schema struct<> --- !query 104 output +-- !query 84 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS DECIMAL(10,0)) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 105 +-- !query 85 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as tinyint) END FROM t --- !query 105 schema +-- !query 85 schema struct --- !query 105 output +-- !query 85 output 1 --- !query 106 +-- !query 86 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as smallint) END FROM t --- !query 106 schema -struct --- !query 106 output -1 - - --- !query 107 -SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as short) END FROM t --- !query 107 schema +-- !query 86 schema struct --- !query 107 output +-- !query 86 output 1 --- !query 108 +-- !query 87 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as int) END FROM t --- !query 108 schema +-- !query 87 schema struct --- !query 108 output +-- !query 87 output 1 --- !query 109 +-- !query 88 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as bigint) END FROM t --- !query 109 schema +-- !query 88 schema struct --- !query 109 output +-- !query 88 output 1 --- !query 110 +-- !query 89 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as float) END FROM t --- !query 110 schema +-- !query 89 schema struct --- !query 110 output +-- !query 89 output 1 --- !query 111 +-- !query 90 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as double) END FROM t --- !query 111 schema +-- !query 90 schema struct --- !query 111 output +-- !query 90 output 1 --- !query 112 +-- !query 91 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 112 schema +-- !query 91 schema struct --- !query 112 output +-- !query 91 output 1 --- !query 113 +-- !query 92 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as string) END FROM t --- !query 113 schema +-- !query 92 schema struct --- !query 113 output +-- !query 92 output 1 --- !query 114 +-- !query 93 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2' as binary) END FROM t --- !query 114 schema +-- !query 93 schema struct<> --- !query 114 output +-- !query 93 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS STRING) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 115 +-- !query 94 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast(2 as boolean) END FROM t --- !query 115 schema +-- !query 94 schema struct<> --- !query 115 output +-- !query 94 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS STRING) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 116 +-- !query 95 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 116 schema +-- !query 95 schema struct --- !query 116 output +-- !query 95 output 1 --- !query 117 +-- !query 96 SELECT CASE WHEN true THEN cast(1 as string) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 117 schema +-- !query 96 schema struct --- !query 117 output +-- !query 96 output 1 --- !query 118 +-- !query 97 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as tinyint) END FROM t --- !query 118 schema +-- !query 97 schema struct<> --- !query 118 output +-- !query 97 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 119 +-- !query 98 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as smallint) END FROM t --- !query 119 schema -struct<> --- !query 119 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 120 -SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as short) END FROM t --- !query 120 schema +-- !query 98 schema struct<> --- !query 120 output +-- !query 98 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 121 +-- !query 99 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as int) END FROM t --- !query 121 schema +-- !query 99 schema struct<> --- !query 121 output +-- !query 99 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 122 +-- !query 100 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as bigint) END FROM t --- !query 122 schema +-- !query 100 schema struct<> --- !query 122 output +-- !query 100 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 123 +-- !query 101 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as float) END FROM t --- !query 123 schema +-- !query 101 schema struct<> --- !query 123 output +-- !query 101 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 124 +-- !query 102 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as double) END FROM t --- !query 124 schema +-- !query 102 schema struct<> --- !query 124 output +-- !query 102 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 125 +-- !query 103 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 125 schema +-- !query 103 schema struct<> --- !query 125 output +-- !query 103 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 126 +-- !query 104 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as string) END FROM t --- !query 126 schema +-- !query 104 schema struct<> --- !query 126 output +-- !query 104 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS STRING) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 127 +-- !query 105 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2' as binary) END FROM t --- !query 127 schema +-- !query 105 schema struct --- !query 127 output +-- !query 105 output 1 --- !query 128 +-- !query 106 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast(2 as boolean) END FROM t --- !query 128 schema +-- !query 106 schema struct<> --- !query 128 output +-- !query 106 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 129 +-- !query 107 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 129 schema +-- !query 107 schema struct<> --- !query 129 output +-- !query 107 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 130 +-- !query 108 SELECT CASE WHEN true THEN cast('1' as binary) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 130 schema +-- !query 108 schema struct<> --- !query 130 output +-- !query 108 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('1' AS BINARY) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 131 +-- !query 109 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as tinyint) END FROM t --- !query 131 schema +-- !query 109 schema struct<> --- !query 131 output +-- !query 109 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 132 +-- !query 110 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as smallint) END FROM t --- !query 132 schema -struct<> --- !query 132 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 133 -SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as short) END FROM t --- !query 133 schema +-- !query 110 schema struct<> --- !query 133 output +-- !query 110 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 134 +-- !query 111 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as int) END FROM t --- !query 134 schema +-- !query 111 schema struct<> --- !query 134 output +-- !query 111 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 135 +-- !query 112 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as bigint) END FROM t --- !query 135 schema +-- !query 112 schema struct<> --- !query 135 output +-- !query 112 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 136 +-- !query 113 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as float) END FROM t --- !query 136 schema +-- !query 113 schema struct<> --- !query 136 output +-- !query 113 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 137 +-- !query 114 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as double) END FROM t --- !query 137 schema +-- !query 114 schema struct<> --- !query 137 output +-- !query 114 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 138 +-- !query 115 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 138 schema +-- !query 115 schema struct<> --- !query 138 output +-- !query 115 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 139 +-- !query 116 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as string) END FROM t --- !query 139 schema +-- !query 116 schema struct<> --- !query 139 output +-- !query 116 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST(2 AS STRING) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 140 +-- !query 117 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2' as binary) END FROM t --- !query 140 schema +-- !query 117 schema struct<> --- !query 140 output +-- !query 117 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 141 +-- !query 118 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast(2 as boolean) END FROM t --- !query 141 schema +-- !query 118 schema struct --- !query 141 output +-- !query 118 output true --- !query 142 +-- !query 119 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 142 schema +-- !query 119 schema struct<> --- !query 142 output +-- !query 119 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST('2017-12-11 09:30:00.0' AS TIMESTAMP) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 143 +-- !query 120 SELECT CASE WHEN true THEN cast(1 as boolean) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 143 schema +-- !query 120 schema struct<> --- !query 143 output +-- !query 120 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST(1 AS BOOLEAN) ELSE CAST('2017-12-11 09:30:00' AS DATE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 144 +-- !query 121 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as tinyint) END FROM t --- !query 144 schema +-- !query 121 schema struct<> --- !query 144 output +-- !query 121 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 145 +-- !query 122 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as smallint) END FROM t --- !query 145 schema -struct<> --- !query 145 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 146 -SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as short) END FROM t --- !query 146 schema +-- !query 122 schema struct<> --- !query 146 output +-- !query 122 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 147 +-- !query 123 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as int) END FROM t --- !query 147 schema +-- !query 123 schema struct<> --- !query 147 output +-- !query 123 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 148 +-- !query 124 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as bigint) END FROM t --- !query 148 schema +-- !query 124 schema struct<> --- !query 148 output +-- !query 124 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 149 +-- !query 125 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as float) END FROM t --- !query 149 schema +-- !query 125 schema struct<> --- !query 149 output +-- !query 125 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 150 +-- !query 126 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as double) END FROM t --- !query 150 schema +-- !query 126 schema struct<> --- !query 150 output +-- !query 126 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 151 +-- !query 127 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 151 schema +-- !query 127 schema struct<> --- !query 151 output +-- !query 127 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 152 +-- !query 128 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as string) END FROM t --- !query 152 schema +-- !query 128 schema struct --- !query 152 output +-- !query 128 output 2017-12-12 09:30:00 --- !query 153 +-- !query 129 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2' as binary) END FROM t --- !query 153 schema +-- !query 129 schema struct<> --- !query 153 output +-- !query 129 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 154 +-- !query 130 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast(2 as boolean) END FROM t --- !query 154 schema +-- !query 130 schema struct<> --- !query 154 output +-- !query 130 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00.0' AS TIMESTAMP) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 155 +-- !query 131 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 155 schema +-- !query 131 schema struct --- !query 155 output +-- !query 131 output 2017-12-12 09:30:00 --- !query 156 +-- !query 132 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00.0' as timestamp) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 156 schema +-- !query 132 schema struct --- !query 156 output +-- !query 132 output 2017-12-12 09:30:00 --- !query 157 +-- !query 133 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as tinyint) END FROM t --- !query 157 schema +-- !query 133 schema struct<> --- !query 157 output +-- !query 133 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS TINYINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 158 +-- !query 134 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as smallint) END FROM t --- !query 158 schema -struct<> --- !query 158 output -org.apache.spark.sql.AnalysisException -cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 - - --- !query 159 -SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as short) END FROM t --- !query 159 schema +-- !query 134 schema struct<> --- !query 159 output +-- !query 134 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS SMALLINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 160 +-- !query 135 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as int) END FROM t --- !query 160 schema +-- !query 135 schema struct<> --- !query 160 output +-- !query 135 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS INT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 161 +-- !query 136 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as bigint) END FROM t --- !query 161 schema +-- !query 136 schema struct<> --- !query 161 output +-- !query 136 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS BIGINT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 162 +-- !query 137 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as float) END FROM t --- !query 162 schema +-- !query 137 schema struct<> --- !query 162 output +-- !query 137 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS FLOAT) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 163 +-- !query 138 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as double) END FROM t --- !query 163 schema +-- !query 138 schema struct<> --- !query 163 output +-- !query 138 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS DOUBLE) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 164 +-- !query 139 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as decimal(10, 0)) END FROM t --- !query 164 schema +-- !query 139 schema struct<> --- !query 164 output +-- !query 139 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS DECIMAL(10,0)) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 165 +-- !query 140 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as string) END FROM t --- !query 165 schema +-- !query 140 schema struct --- !query 165 output +-- !query 140 output 2017-12-12 --- !query 166 +-- !query 141 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2' as binary) END FROM t --- !query 166 schema +-- !query 141 schema struct<> --- !query 166 output +-- !query 141 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST('2' AS BINARY) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 167 +-- !query 142 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast(2 as boolean) END FROM t --- !query 167 schema +-- !query 142 schema struct<> --- !query 167 output +-- !query 142 output org.apache.spark.sql.AnalysisException cannot resolve 'CASE WHEN true THEN CAST('2017-12-12 09:30:00' AS DATE) ELSE CAST(2 AS BOOLEAN) END' due to data type mismatch: THEN and ELSE expressions should all be same type or coercible to a common type; line 1 pos 7 --- !query 168 +-- !query 143 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2017-12-11 09:30:00.0' as timestamp) END FROM t --- !query 168 schema +-- !query 143 schema struct --- !query 168 output +-- !query 143 output 2017-12-12 00:00:00 --- !query 169 +-- !query 144 SELECT CASE WHEN true THEN cast('2017-12-12 09:30:00' as date) ELSE cast('2017-12-11 09:30:00' as date) END FROM t --- !query 169 schema +-- !query 144 schema struct --- !query 169 output +-- !query 144 output 2017-12-12 diff --git a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out index 3f8dd8336e82a..7097027872707 100644 --- a/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out +++ b/sql/core/src/test/resources/sql-tests/results/typeCoercion/native/ifCoercion.sql.out @@ -1,5 +1,5 @@ -- Automatically generated by SQLQueryTestSuite --- Number of queries: 170 +-- Number of queries: 145 -- !query 0 @@ -27,1414 +27,1206 @@ struct<(IF(true, CAST(CAST(1 AS TINYINT) AS SMALLINT), CAST(2 AS SMALLINT))):sma -- !query 3 -SELECT IF(true, cast(1 as tinyint), cast(2 as short)) FROM t +SELECT IF(true, cast(1 as tinyint), cast(2 as int)) FROM t -- !query 3 schema -struct<(IF(true, CAST(CAST(1 AS TINYINT) AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS INT), CAST(2 AS INT))):int> -- !query 3 output 1 -- !query 4 -SELECT IF(true, cast(1 as tinyint), cast(2 as int)) FROM t +SELECT IF(true, cast(1 as tinyint), cast(2 as bigint)) FROM t -- !query 4 schema -struct<(IF(true, CAST(CAST(1 AS TINYINT) AS INT), CAST(2 AS INT))):int> +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> -- !query 4 output 1 -- !query 5 -SELECT IF(true, cast(1 as tinyint), cast(2 as bigint)) FROM t +SELECT IF(true, cast(1 as tinyint), cast(2 as float)) FROM t -- !query 5 schema -struct<(IF(true, CAST(CAST(1 AS TINYINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS FLOAT), CAST(2 AS FLOAT))):float> -- !query 5 output -1 +1.0 -- !query 6 -SELECT IF(true, cast(1 as tinyint), cast(2 as float)) FROM t +SELECT IF(true, cast(1 as tinyint), cast(2 as double)) FROM t -- !query 6 schema -struct<(IF(true, CAST(CAST(1 AS TINYINT) AS FLOAT), CAST(2 AS FLOAT))):float> +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> -- !query 6 output 1.0 -- !query 7 -SELECT IF(true, cast(1 as tinyint), cast(2 as double)) FROM t +SELECT IF(true, cast(1 as tinyint), cast(2 as decimal(10, 0))) FROM t -- !query 7 schema -struct<(IF(true, CAST(CAST(1 AS TINYINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> -- !query 7 output -1.0 +1 -- !query 8 -SELECT IF(true, cast(1 as tinyint), cast(2 as decimal(10, 0))) FROM t +SELECT IF(true, cast(1 as tinyint), cast(2 as string)) FROM t -- !query 8 schema -struct<(IF(true, CAST(CAST(1 AS TINYINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +struct<(IF(true, CAST(CAST(1 AS TINYINT) AS STRING), CAST(2 AS STRING))):string> -- !query 8 output 1 -- !query 9 -SELECT IF(true, cast(1 as tinyint), cast(2 as string)) FROM t +SELECT IF(true, cast(1 as tinyint), cast('2' as binary)) FROM t -- !query 9 schema -struct<(IF(true, CAST(CAST(1 AS TINYINT) AS STRING), CAST(2 AS STRING))):string> +struct<> -- !query 9 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2' AS BINARY)))' (tinyint and binary).; line 1 pos 7 -- !query 10 -SELECT IF(true, cast(1 as tinyint), cast('2' as binary)) FROM t +SELECT IF(true, cast(1 as tinyint), cast(2 as boolean)) FROM t -- !query 10 schema struct<> -- !query 10 output org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2' AS BINARY)))' (tinyint and binary).; line 1 pos 7 +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST(2 AS BOOLEAN)))' (tinyint and boolean).; line 1 pos 7 -- !query 11 -SELECT IF(true, cast(1 as tinyint), cast(2 as boolean)) FROM t +SELECT IF(true, 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 '(IF(true, CAST(1 AS TINYINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST(2 AS BOOLEAN)))' (tinyint and boolean).; line 1 pos 7 +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (tinyint and timestamp).; line 1 pos 7 -- !query 12 -SELECT IF(true, cast(1 as tinyint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +SELECT IF(true, 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 '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (tinyint and timestamp).; line 1 pos 7 +cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00' AS DATE)))' (tinyint and date).; line 1 pos 7 -- !query 13 -SELECT IF(true, cast(1 as tinyint), cast('2017-12-11 09:30:00' as date)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as tinyint)) FROM t -- !query 13 schema -struct<> +struct<(IF(true, CAST(1 AS SMALLINT), CAST(CAST(2 AS TINYINT) AS SMALLINT))):smallint> -- !query 13 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS TINYINT), CAST('2017-12-11 09:30:00' AS DATE)))' (tinyint and date).; line 1 pos 7 +1 -- !query 14 -SELECT IF(true, cast(1 as smallint), cast(2 as tinyint)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as smallint)) FROM t -- !query 14 schema -struct<(IF(true, CAST(1 AS SMALLINT), CAST(CAST(2 AS TINYINT) AS SMALLINT))):smallint> +struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> -- !query 14 output 1 -- !query 15 -SELECT IF(true, cast(1 as smallint), cast(2 as smallint)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as int)) FROM t -- !query 15 schema -struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS INT), CAST(2 AS INT))):int> -- !query 15 output 1 -- !query 16 -SELECT IF(true, cast(1 as smallint), cast(2 as short)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as bigint)) FROM t -- !query 16 schema -struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> -- !query 16 output 1 -- !query 17 -SELECT IF(true, cast(1 as smallint), cast(2 as int)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as float)) FROM t -- !query 17 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS INT), CAST(2 AS INT))):int> +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS FLOAT), CAST(2 AS FLOAT))):float> -- !query 17 output -1 +1.0 -- !query 18 -SELECT IF(true, cast(1 as smallint), cast(2 as bigint)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as double)) FROM t -- !query 18 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> -- !query 18 output -1 +1.0 -- !query 19 -SELECT IF(true, cast(1 as smallint), cast(2 as float)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as decimal(10, 0))) FROM t -- !query 19 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS FLOAT), CAST(2 AS FLOAT))):float> +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> -- !query 19 output -1.0 +1 -- !query 20 -SELECT IF(true, cast(1 as smallint), cast(2 as double)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as string)) FROM t -- !query 20 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS STRING), CAST(2 AS STRING))):string> -- !query 20 output -1.0 +1 -- !query 21 -SELECT IF(true, cast(1 as smallint), cast(2 as decimal(10, 0))) FROM t +SELECT IF(true, cast(1 as smallint), cast('2' as binary)) FROM t -- !query 21 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +struct<> -- !query 21 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' (smallint and binary).; line 1 pos 7 -- !query 22 -SELECT IF(true, cast(1 as smallint), cast(2 as string)) FROM t +SELECT IF(true, cast(1 as smallint), cast(2 as boolean)) FROM t -- !query 22 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS STRING), CAST(2 AS STRING))):string> +struct<> -- !query 22 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' (smallint and boolean).; line 1 pos 7 -- !query 23 -SELECT IF(true, cast(1 as smallint), cast('2' as binary)) FROM t +SELECT IF(true, 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 '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' (smallint and binary).; line 1 pos 7 +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (smallint and timestamp).; line 1 pos 7 -- !query 24 -SELECT IF(true, cast(1 as smallint), cast(2 as boolean)) FROM t +SELECT IF(true, 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 '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' (smallint and boolean).; line 1 pos 7 +cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' (smallint and date).; line 1 pos 7 -- !query 25 -SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as tinyint)) FROM t -- !query 25 schema -struct<> +struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS TINYINT) AS INT))):int> -- !query 25 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (smallint and timestamp).; line 1 pos 7 +1 -- !query 26 -SELECT IF(true, cast(1 as smallint), cast('2017-12-11 09:30:00' as date)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as smallint)) FROM t -- !query 26 schema -struct<> +struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS SMALLINT) AS INT))):int> -- !query 26 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' (smallint and date).; line 1 pos 7 +1 -- !query 27 -SELECT IF(true, cast(1 as short), cast(2 as tinyint)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as int)) FROM t -- !query 27 schema -struct<(IF(true, CAST(1 AS SMALLINT), CAST(CAST(2 AS TINYINT) AS SMALLINT))):smallint> +struct<(IF(true, CAST(1 AS INT), CAST(2 AS INT))):int> -- !query 27 output 1 -- !query 28 -SELECT IF(true, cast(1 as short), cast(2 as smallint)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as bigint)) FROM t -- !query 28 schema -struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +struct<(IF(true, CAST(CAST(1 AS INT) AS BIGINT), CAST(2 AS BIGINT))):bigint> -- !query 28 output 1 -- !query 29 -SELECT IF(true, cast(1 as short), cast(2 as short)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as float)) FROM t -- !query 29 schema -struct<(IF(true, CAST(1 AS SMALLINT), CAST(2 AS SMALLINT))):smallint> +struct<(IF(true, CAST(CAST(1 AS INT) AS FLOAT), CAST(2 AS FLOAT))):float> -- !query 29 output -1 +1.0 -- !query 30 -SELECT IF(true, cast(1 as short), cast(2 as int)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as double)) FROM t -- !query 30 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS INT), CAST(2 AS INT))):int> +struct<(IF(true, CAST(CAST(1 AS INT) AS DOUBLE), CAST(2 AS DOUBLE))):double> -- !query 30 output -1 +1.0 -- !query 31 -SELECT IF(true, cast(1 as short), cast(2 as bigint)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as decimal(10, 0))) FROM t -- !query 31 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +struct<(IF(true, CAST(CAST(1 AS INT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> -- !query 31 output 1 -- !query 32 -SELECT IF(true, cast(1 as short), cast(2 as float)) FROM t +SELECT IF(true, cast(1 as int), cast(2 as string)) FROM t -- !query 32 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS FLOAT), CAST(2 AS FLOAT))):float> +struct<(IF(true, CAST(CAST(1 AS INT) AS STRING), CAST(2 AS STRING))):string> -- !query 32 output -1.0 +1 -- !query 33 -SELECT IF(true, cast(1 as short), cast(2 as double)) FROM t +SELECT IF(true, cast(1 as int), cast('2' as binary)) FROM t -- !query 33 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +struct<> -- !query 33 output -1.0 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS INT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2' AS BINARY)))' (int and binary).; line 1 pos 7 -- !query 34 -SELECT IF(true, cast(1 as short), cast(2 as decimal(10, 0))) FROM t +SELECT IF(true, cast(1 as int), cast(2 as boolean)) FROM t -- !query 34 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +struct<> -- !query 34 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS INT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST(2 AS BOOLEAN)))' (int and boolean).; line 1 pos 7 -- !query 35 -SELECT IF(true, cast(1 as short), cast(2 as string)) FROM t +SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t -- !query 35 schema -struct<(IF(true, CAST(CAST(1 AS SMALLINT) AS STRING), CAST(2 AS STRING))):string> +struct<> -- !query 35 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (int and timestamp).; line 1 pos 7 -- !query 36 -SELECT IF(true, cast(1 as short), cast('2' as binary)) FROM t +SELECT IF(true, 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 '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2' AS BINARY)))' (smallint and binary).; line 1 pos 7 +cannot resolve '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00' AS DATE)))' (int and date).; line 1 pos 7 -- !query 37 -SELECT IF(true, cast(1 as short), cast(2 as boolean)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as tinyint)) FROM t -- !query 37 schema -struct<> +struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS TINYINT) AS BIGINT))):bigint> -- !query 37 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST(2 AS BOOLEAN)))' (smallint and boolean).; line 1 pos 7 +1 -- !query 38 -SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as smallint)) FROM t -- !query 38 schema -struct<> +struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS SMALLINT) AS BIGINT))):bigint> -- !query 38 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (smallint and timestamp).; line 1 pos 7 +1 -- !query 39 -SELECT IF(true, cast(1 as short), cast('2017-12-11 09:30:00' as date)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as int)) FROM t -- !query 39 schema -struct<> +struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS INT) AS BIGINT))):bigint> -- !query 39 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS SMALLINT), CAST('2017-12-11 09:30:00' AS DATE)))' (smallint and date).; line 1 pos 7 +1 -- !query 40 -SELECT IF(true, cast(1 as int), cast(2 as tinyint)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as bigint)) FROM t -- !query 40 schema -struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS TINYINT) AS INT))):int> +struct<(IF(true, CAST(1 AS BIGINT), CAST(2 AS BIGINT))):bigint> -- !query 40 output 1 -- !query 41 -SELECT IF(true, cast(1 as int), cast(2 as smallint)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as float)) FROM t -- !query 41 schema -struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS SMALLINT) AS INT))):int> +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS FLOAT), CAST(2 AS FLOAT))):float> -- !query 41 output -1 +1.0 -- !query 42 -SELECT IF(true, cast(1 as int), cast(2 as short)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as double)) FROM t -- !query 42 schema -struct<(IF(true, CAST(1 AS INT), CAST(CAST(2 AS SMALLINT) AS INT))):int> +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> -- !query 42 output -1 +1.0 -- !query 43 -SELECT IF(true, cast(1 as int), cast(2 as int)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as decimal(10, 0))) FROM t -- !query 43 schema -struct<(IF(true, CAST(1 AS INT), CAST(2 AS INT))):int> +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS DECIMAL(20,0)), CAST(CAST(2 AS DECIMAL(10,0)) AS DECIMAL(20,0)))):decimal(20,0)> -- !query 43 output 1 -- !query 44 -SELECT IF(true, cast(1 as int), cast(2 as bigint)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as string)) FROM t -- !query 44 schema -struct<(IF(true, CAST(CAST(1 AS INT) AS BIGINT), CAST(2 AS BIGINT))):bigint> +struct<(IF(true, CAST(CAST(1 AS BIGINT) AS STRING), CAST(2 AS STRING))):string> -- !query 44 output 1 -- !query 45 -SELECT IF(true, cast(1 as int), cast(2 as float)) FROM t +SELECT IF(true, cast(1 as bigint), cast('2' as binary)) FROM t -- !query 45 schema -struct<(IF(true, CAST(CAST(1 AS INT) AS FLOAT), CAST(2 AS FLOAT))):float> +struct<> -- !query 45 output -1.0 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2' AS BINARY)))' (bigint and binary).; line 1 pos 7 -- !query 46 -SELECT IF(true, cast(1 as int), cast(2 as double)) FROM t +SELECT IF(true, cast(1 as bigint), cast(2 as boolean)) FROM t -- !query 46 schema -struct<(IF(true, CAST(CAST(1 AS INT) AS DOUBLE), CAST(2 AS DOUBLE))):double> +struct<> -- !query 46 output -1.0 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST(2 AS BOOLEAN)))' (bigint and boolean).; line 1 pos 7 -- !query 47 -SELECT IF(true, cast(1 as int), cast(2 as decimal(10, 0))) FROM t +SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t -- !query 47 schema -struct<(IF(true, CAST(CAST(1 AS INT) AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> +struct<> -- !query 47 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (bigint and timestamp).; line 1 pos 7 -- !query 48 -SELECT IF(true, cast(1 as int), cast(2 as string)) FROM t +SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00' as date)) FROM t -- !query 48 schema -struct<(IF(true, CAST(CAST(1 AS INT) AS STRING), CAST(2 AS STRING))):string> +struct<> -- !query 48 output -1 +org.apache.spark.sql.AnalysisException +cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00' AS DATE)))' (bigint and date).; line 1 pos 7 -- !query 49 -SELECT IF(true, cast(1 as int), cast('2' as binary)) FROM t +SELECT IF(true, cast(1 as float), cast(2 as tinyint)) FROM t -- !query 49 schema -struct<> +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS TINYINT) AS FLOAT))):float> -- !query 49 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS INT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2' AS BINARY)))' (int and binary).; line 1 pos 7 +1.0 -- !query 50 -SELECT IF(true, cast(1 as int), cast(2 as boolean)) FROM t +SELECT IF(true, cast(1 as float), cast(2 as smallint)) FROM t -- !query 50 schema -struct<> +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS SMALLINT) AS FLOAT))):float> -- !query 50 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS INT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST(2 AS BOOLEAN)))' (int and boolean).; line 1 pos 7 +1.0 -- !query 51 -SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t +SELECT IF(true, cast(1 as float), cast(2 as int)) FROM t -- !query 51 schema -struct<> +struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS INT) AS FLOAT))):float> -- !query 51 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (int and timestamp).; line 1 pos 7 - - --- !query 52 -SELECT IF(true, cast(1 as int), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 52 schema -struct<> --- !query 52 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS INT), CAST('2017-12-11 09:30:00' AS DATE)))' (int and date).; line 1 pos 7 - - --- !query 53 -SELECT IF(true, cast(1 as bigint), cast(2 as tinyint)) FROM t --- !query 53 schema -struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS TINYINT) AS BIGINT))):bigint> --- !query 53 output -1 - - --- !query 54 -SELECT IF(true, cast(1 as bigint), cast(2 as smallint)) FROM t --- !query 54 schema -struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS SMALLINT) AS BIGINT))):bigint> --- !query 54 output -1 - - --- !query 55 -SELECT IF(true, cast(1 as bigint), cast(2 as short)) FROM t --- !query 55 schema -struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS SMALLINT) AS BIGINT))):bigint> --- !query 55 output -1 - - --- !query 56 -SELECT IF(true, cast(1 as bigint), cast(2 as int)) FROM t --- !query 56 schema -struct<(IF(true, CAST(1 AS BIGINT), CAST(CAST(2 AS INT) AS BIGINT))):bigint> --- !query 56 output -1 - - --- !query 57 -SELECT IF(true, cast(1 as bigint), cast(2 as bigint)) FROM t --- !query 57 schema -struct<(IF(true, CAST(1 AS BIGINT), CAST(2 AS BIGINT))):bigint> --- !query 57 output -1 - - --- !query 58 -SELECT IF(true, cast(1 as bigint), cast(2 as float)) FROM t --- !query 58 schema -struct<(IF(true, CAST(CAST(1 AS BIGINT) AS FLOAT), CAST(2 AS FLOAT))):float> --- !query 58 output -1.0 - - --- !query 59 -SELECT IF(true, cast(1 as bigint), cast(2 as double)) FROM t --- !query 59 schema -struct<(IF(true, CAST(CAST(1 AS BIGINT) AS DOUBLE), CAST(2 AS DOUBLE))):double> --- !query 59 output -1.0 - - --- !query 60 -SELECT IF(true, cast(1 as bigint), cast(2 as decimal(10, 0))) FROM t --- !query 60 schema -struct<(IF(true, CAST(CAST(1 AS BIGINT) AS DECIMAL(20,0)), CAST(CAST(2 AS DECIMAL(10,0)) AS DECIMAL(20,0)))):decimal(20,0)> --- !query 60 output -1 - - --- !query 61 -SELECT IF(true, cast(1 as bigint), cast(2 as string)) FROM t --- !query 61 schema -struct<(IF(true, CAST(CAST(1 AS BIGINT) AS STRING), CAST(2 AS STRING))):string> --- !query 61 output -1 - - --- !query 62 -SELECT IF(true, cast(1 as bigint), cast('2' as binary)) FROM t --- !query 62 schema -struct<> --- !query 62 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2' AS BINARY)))' (bigint and binary).; line 1 pos 7 - - --- !query 63 -SELECT IF(true, cast(1 as bigint), cast(2 as boolean)) FROM t --- !query 63 schema -struct<> --- !query 63 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST(2 AS BOOLEAN)))' (bigint and boolean).; line 1 pos 7 - - --- !query 64 -SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 64 schema -struct<> --- !query 64 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (bigint and timestamp).; line 1 pos 7 - - --- !query 65 -SELECT IF(true, cast(1 as bigint), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 65 schema -struct<> --- !query 65 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BIGINT), CAST('2017-12-11 09:30:00' AS DATE)))' (bigint and date).; line 1 pos 7 - - --- !query 66 -SELECT IF(true, cast(1 as float), cast(2 as tinyint)) FROM t --- !query 66 schema -struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS TINYINT) AS FLOAT))):float> --- !query 66 output -1.0 - - --- !query 67 -SELECT IF(true, cast(1 as float), cast(2 as smallint)) FROM t --- !query 67 schema -struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS SMALLINT) AS FLOAT))):float> --- !query 67 output -1.0 - - --- !query 68 -SELECT IF(true, cast(1 as float), cast(2 as short)) FROM t --- !query 68 schema -struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS SMALLINT) AS FLOAT))):float> --- !query 68 output -1.0 - - --- !query 69 -SELECT IF(true, cast(1 as float), cast(2 as int)) FROM t --- !query 69 schema -struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS INT) AS FLOAT))):float> --- !query 69 output 1.0 --- !query 70 +-- !query 52 SELECT IF(true, cast(1 as float), cast(2 as bigint)) FROM t --- !query 70 schema +-- !query 52 schema struct<(IF(true, CAST(1 AS FLOAT), CAST(CAST(2 AS BIGINT) AS FLOAT))):float> --- !query 70 output +-- !query 52 output 1.0 --- !query 71 +-- !query 53 SELECT IF(true, cast(1 as float), cast(2 as float)) FROM t --- !query 71 schema +-- !query 53 schema struct<(IF(true, CAST(1 AS FLOAT), CAST(2 AS FLOAT))):float> --- !query 71 output +-- !query 53 output 1.0 --- !query 72 +-- !query 54 SELECT IF(true, cast(1 as float), cast(2 as double)) FROM t --- !query 72 schema +-- !query 54 schema struct<(IF(true, CAST(CAST(1 AS FLOAT) AS DOUBLE), CAST(2 AS DOUBLE))):double> --- !query 72 output +-- !query 54 output 1.0 --- !query 73 +-- !query 55 SELECT IF(true, cast(1 as float), cast(2 as decimal(10, 0))) FROM t --- !query 73 schema +-- !query 55 schema struct<(IF(true, CAST(CAST(1 AS FLOAT) AS DOUBLE), CAST(CAST(2 AS DECIMAL(10,0)) AS DOUBLE))):double> --- !query 73 output +-- !query 55 output 1.0 --- !query 74 +-- !query 56 SELECT IF(true, cast(1 as float), cast(2 as string)) FROM t --- !query 74 schema +-- !query 56 schema struct<(IF(true, CAST(CAST(1 AS FLOAT) AS STRING), CAST(2 AS STRING))):string> --- !query 74 output +-- !query 56 output 1.0 --- !query 75 +-- !query 57 SELECT IF(true, cast(1 as float), cast('2' as binary)) FROM t --- !query 75 schema +-- !query 57 schema struct<> --- !query 75 output +-- !query 57 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST('2' AS BINARY)))' (float and binary).; line 1 pos 7 --- !query 76 +-- !query 58 SELECT IF(true, cast(1 as float), cast(2 as boolean)) FROM t --- !query 76 schema +-- !query 58 schema struct<> --- !query 76 output +-- !query 58 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST(2 AS BOOLEAN)))' (float and boolean).; line 1 pos 7 --- !query 77 +-- !query 59 SELECT IF(true, cast(1 as float), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 77 schema +-- !query 59 schema struct<> --- !query 77 output +-- !query 59 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (float and timestamp).; line 1 pos 7 --- !query 78 +-- !query 60 SELECT IF(true, cast(1 as float), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 78 schema +-- !query 60 schema struct<> --- !query 78 output +-- !query 60 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS FLOAT), CAST('2017-12-11 09:30:00' AS DATE)))' (float and date).; line 1 pos 7 --- !query 79 +-- !query 61 SELECT IF(true, cast(1 as double), cast(2 as tinyint)) FROM t --- !query 79 schema +-- !query 61 schema struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS TINYINT) AS DOUBLE))):double> --- !query 79 output +-- !query 61 output 1.0 --- !query 80 +-- !query 62 SELECT IF(true, cast(1 as double), cast(2 as smallint)) FROM t --- !query 80 schema -struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS SMALLINT) AS DOUBLE))):double> --- !query 80 output -1.0 - - --- !query 81 -SELECT IF(true, cast(1 as double), cast(2 as short)) FROM t --- !query 81 schema +-- !query 62 schema struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS SMALLINT) AS DOUBLE))):double> --- !query 81 output +-- !query 62 output 1.0 --- !query 82 +-- !query 63 SELECT IF(true, cast(1 as double), cast(2 as int)) FROM t --- !query 82 schema +-- !query 63 schema struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS INT) AS DOUBLE))):double> --- !query 82 output +-- !query 63 output 1.0 --- !query 83 +-- !query 64 SELECT IF(true, cast(1 as double), cast(2 as bigint)) FROM t --- !query 83 schema +-- !query 64 schema struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS BIGINT) AS DOUBLE))):double> --- !query 83 output +-- !query 64 output 1.0 --- !query 84 +-- !query 65 SELECT IF(true, cast(1 as double), cast(2 as float)) FROM t --- !query 84 schema +-- !query 65 schema struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS FLOAT) AS DOUBLE))):double> --- !query 84 output +-- !query 65 output 1.0 --- !query 85 +-- !query 66 SELECT IF(true, cast(1 as double), cast(2 as double)) FROM t --- !query 85 schema +-- !query 66 schema struct<(IF(true, CAST(1 AS DOUBLE), CAST(2 AS DOUBLE))):double> --- !query 85 output +-- !query 66 output 1.0 --- !query 86 +-- !query 67 SELECT IF(true, cast(1 as double), cast(2 as decimal(10, 0))) FROM t --- !query 86 schema +-- !query 67 schema struct<(IF(true, CAST(1 AS DOUBLE), CAST(CAST(2 AS DECIMAL(10,0)) AS DOUBLE))):double> --- !query 86 output +-- !query 67 output 1.0 --- !query 87 +-- !query 68 SELECT IF(true, cast(1 as double), cast(2 as string)) FROM t --- !query 87 schema +-- !query 68 schema struct<(IF(true, CAST(CAST(1 AS DOUBLE) AS STRING), CAST(2 AS STRING))):string> --- !query 87 output +-- !query 68 output 1.0 --- !query 88 +-- !query 69 SELECT IF(true, cast(1 as double), cast('2' as binary)) FROM t --- !query 88 schema +-- !query 69 schema struct<> --- !query 88 output +-- !query 69 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST('2' AS BINARY)))' (double and binary).; line 1 pos 7 --- !query 89 +-- !query 70 SELECT IF(true, cast(1 as double), cast(2 as boolean)) FROM t --- !query 89 schema +-- !query 70 schema struct<> --- !query 89 output +-- !query 70 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST(2 AS BOOLEAN)))' (double and boolean).; line 1 pos 7 --- !query 90 +-- !query 71 SELECT IF(true, cast(1 as double), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 90 schema +-- !query 71 schema struct<> --- !query 90 output +-- !query 71 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (double and timestamp).; line 1 pos 7 --- !query 91 +-- !query 72 SELECT IF(true, cast(1 as double), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 91 schema +-- !query 72 schema struct<> --- !query 91 output +-- !query 72 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DOUBLE), CAST('2017-12-11 09:30:00' AS DATE)))' (double and date).; line 1 pos 7 --- !query 92 +-- !query 73 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as tinyint)) FROM t --- !query 92 schema +-- !query 73 schema struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS TINYINT) AS DECIMAL(10,0)))):decimal(10,0)> --- !query 92 output +-- !query 73 output 1 --- !query 93 +-- !query 74 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as smallint)) FROM t --- !query 93 schema -struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS SMALLINT) AS DECIMAL(10,0)))):decimal(10,0)> --- !query 93 output -1 - - --- !query 94 -SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as short)) FROM t --- !query 94 schema +-- !query 74 schema struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS SMALLINT) AS DECIMAL(10,0)))):decimal(10,0)> --- !query 94 output +-- !query 74 output 1 --- !query 95 +-- !query 75 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as int)) FROM t --- !query 95 schema +-- !query 75 schema struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(CAST(2 AS INT) AS DECIMAL(10,0)))):decimal(10,0)> --- !query 95 output +-- !query 75 output 1 --- !query 96 +-- !query 76 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as bigint)) FROM t --- !query 96 schema +-- !query 76 schema struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS DECIMAL(20,0)), CAST(CAST(2 AS BIGINT) AS DECIMAL(20,0)))):decimal(20,0)> --- !query 96 output +-- !query 76 output 1 --- !query 97 +-- !query 77 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as float)) FROM t --- !query 97 schema +-- !query 77 schema struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE), CAST(CAST(2 AS FLOAT) AS DOUBLE))):double> --- !query 97 output +-- !query 77 output 1.0 --- !query 98 +-- !query 78 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as double)) FROM t --- !query 98 schema +-- !query 78 schema struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS DOUBLE), CAST(2 AS DOUBLE))):double> --- !query 98 output +-- !query 78 output 1.0 --- !query 99 +-- !query 79 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as decimal(10, 0))) FROM t --- !query 99 schema +-- !query 79 schema struct<(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(2 AS DECIMAL(10,0)))):decimal(10,0)> --- !query 99 output +-- !query 79 output 1 --- !query 100 +-- !query 80 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as string)) FROM t --- !query 100 schema +-- !query 80 schema struct<(IF(true, CAST(CAST(1 AS DECIMAL(10,0)) AS STRING), CAST(2 AS STRING))):string> --- !query 100 output +-- !query 80 output 1 --- !query 101 +-- !query 81 SELECT IF(true, cast(1 as decimal(10, 0)), cast('2' as binary)) FROM t --- !query 101 schema +-- !query 81 schema struct<> --- !query 101 output +-- !query 81 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2' AS BINARY)))' (decimal(10,0) and binary).; line 1 pos 7 --- !query 102 +-- !query 82 SELECT IF(true, cast(1 as decimal(10, 0)), cast(2 as boolean)) FROM t --- !query 102 schema +-- !query 82 schema struct<> --- !query 102 output +-- !query 82 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST(2 AS BOOLEAN)))' (decimal(10,0) and boolean).; line 1 pos 7 --- !query 103 +-- !query 83 SELECT IF(true, cast(1 as decimal(10, 0)), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 103 schema +-- !query 83 schema struct<> --- !query 103 output +-- !query 83 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, 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 104 +-- !query 84 SELECT IF(true, cast(1 as decimal(10, 0)), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 104 schema +-- !query 84 schema struct<> --- !query 104 output +-- !query 84 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS DECIMAL(10,0)), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, 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 105 +-- !query 85 SELECT IF(true, cast(1 as string), cast(2 as tinyint)) FROM t --- !query 105 schema +-- !query 85 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS TINYINT) AS STRING))):string> --- !query 105 output +-- !query 85 output 1 --- !query 106 +-- !query 86 SELECT IF(true, cast(1 as string), cast(2 as smallint)) FROM t --- !query 106 schema -struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS SMALLINT) AS STRING))):string> --- !query 106 output -1 - - --- !query 107 -SELECT IF(true, cast(1 as string), cast(2 as short)) FROM t --- !query 107 schema +-- !query 86 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS SMALLINT) AS STRING))):string> --- !query 107 output +-- !query 86 output 1 --- !query 108 +-- !query 87 SELECT IF(true, cast(1 as string), cast(2 as int)) FROM t --- !query 108 schema +-- !query 87 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS INT) AS STRING))):string> --- !query 108 output +-- !query 87 output 1 --- !query 109 +-- !query 88 SELECT IF(true, cast(1 as string), cast(2 as bigint)) FROM t --- !query 109 schema +-- !query 88 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS BIGINT) AS STRING))):string> --- !query 109 output +-- !query 88 output 1 --- !query 110 +-- !query 89 SELECT IF(true, cast(1 as string), cast(2 as float)) FROM t --- !query 110 schema +-- !query 89 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS FLOAT) AS STRING))):string> --- !query 110 output +-- !query 89 output 1 --- !query 111 +-- !query 90 SELECT IF(true, cast(1 as string), cast(2 as double)) FROM t --- !query 111 schema +-- !query 90 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS DOUBLE) AS STRING))):string> --- !query 111 output +-- !query 90 output 1 --- !query 112 +-- !query 91 SELECT IF(true, cast(1 as string), cast(2 as decimal(10, 0))) FROM t --- !query 112 schema +-- !query 91 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2 AS DECIMAL(10,0)) AS STRING))):string> --- !query 112 output +-- !query 91 output 1 --- !query 113 +-- !query 92 SELECT IF(true, cast(1 as string), cast(2 as string)) FROM t --- !query 113 schema +-- !query 92 schema struct<(IF(true, CAST(1 AS STRING), CAST(2 AS STRING))):string> --- !query 113 output +-- !query 92 output 1 --- !query 114 +-- !query 93 SELECT IF(true, cast(1 as string), cast('2' as binary)) FROM t --- !query 114 schema +-- !query 93 schema struct<> --- !query 114 output +-- !query 93 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS STRING), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS STRING), CAST('2' AS BINARY)))' (string and binary).; line 1 pos 7 --- !query 115 +-- !query 94 SELECT IF(true, cast(1 as string), cast(2 as boolean)) FROM t --- !query 115 schema +-- !query 94 schema struct<> --- !query 115 output +-- !query 94 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS STRING), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS STRING), CAST(2 AS BOOLEAN)))' (string and boolean).; line 1 pos 7 --- !query 116 +-- !query 95 SELECT IF(true, cast(1 as string), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 116 schema +-- !query 95 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2017-12-11 09:30:00.0 AS TIMESTAMP) AS STRING))):string> --- !query 116 output +-- !query 95 output 1 --- !query 117 +-- !query 96 SELECT IF(true, cast(1 as string), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 117 schema +-- !query 96 schema struct<(IF(true, CAST(1 AS STRING), CAST(CAST(2017-12-11 09:30:00 AS DATE) AS STRING))):string> --- !query 117 output +-- !query 96 output 1 --- !query 118 +-- !query 97 SELECT IF(true, cast('1' as binary), cast(2 as tinyint)) FROM t --- !query 118 schema +-- !query 97 schema struct<> --- !query 118 output +-- !query 97 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS TINYINT)))' (binary and tinyint).; line 1 pos 7 --- !query 119 +-- !query 98 SELECT IF(true, cast('1' as binary), cast(2 as smallint)) FROM t --- !query 119 schema -struct<> --- !query 119 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' (binary and smallint).; line 1 pos 7 - - --- !query 120 -SELECT IF(true, cast('1' as binary), cast(2 as short)) FROM t --- !query 120 schema +-- !query 98 schema struct<> --- !query 120 output +-- !query 98 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS SMALLINT)))' (binary and smallint).; line 1 pos 7 --- !query 121 +-- !query 99 SELECT IF(true, cast('1' as binary), cast(2 as int)) FROM t --- !query 121 schema +-- !query 99 schema struct<> --- !query 121 output +-- !query 99 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS INT)))' (binary and int).; line 1 pos 7 --- !query 122 +-- !query 100 SELECT IF(true, cast('1' as binary), cast(2 as bigint)) FROM t --- !query 122 schema +-- !query 100 schema struct<> --- !query 122 output +-- !query 100 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS BIGINT)))' (binary and bigint).; line 1 pos 7 --- !query 123 +-- !query 101 SELECT IF(true, cast('1' as binary), cast(2 as float)) FROM t --- !query 123 schema +-- !query 101 schema struct<> --- !query 123 output +-- !query 101 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS FLOAT)))' (binary and float).; line 1 pos 7 --- !query 124 +-- !query 102 SELECT IF(true, cast('1' as binary), cast(2 as double)) FROM t --- !query 124 schema +-- !query 102 schema struct<> --- !query 124 output +-- !query 102 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS DOUBLE)))' (binary and double).; line 1 pos 7 --- !query 125 +-- !query 103 SELECT IF(true, cast('1' as binary), cast(2 as decimal(10, 0))) FROM t --- !query 125 schema +-- !query 103 schema struct<> --- !query 125 output +-- !query 103 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS DECIMAL(10,0))))' (binary and decimal(10,0)).; line 1 pos 7 --- !query 126 +-- !query 104 SELECT IF(true, cast('1' as binary), cast(2 as string)) FROM t --- !query 126 schema +-- !query 104 schema struct<> --- !query 126 output +-- !query 104 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS STRING)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS STRING)))' (binary and string).; line 1 pos 7 --- !query 127 +-- !query 105 SELECT IF(true, cast('1' as binary), cast('2' as binary)) FROM t --- !query 127 schema +-- !query 105 schema struct<(IF(true, CAST(1 AS BINARY), CAST(2 AS BINARY))):binary> --- !query 127 output +-- !query 105 output 1 --- !query 128 +-- !query 106 SELECT IF(true, cast('1' as binary), cast(2 as boolean)) FROM t --- !query 128 schema +-- !query 106 schema struct<> --- !query 128 output +-- !query 106 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST(2 AS BOOLEAN)))' (binary and boolean).; line 1 pos 7 --- !query 129 +-- !query 107 SELECT IF(true, cast('1' as binary), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 129 schema +-- !query 107 schema struct<> --- !query 129 output +-- !query 107 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (binary and timestamp).; line 1 pos 7 --- !query 130 +-- !query 108 SELECT IF(true, cast('1' as binary), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 130 schema +-- !query 108 schema struct<> --- !query 130 output +-- !query 108 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST('1' AS BINARY), CAST('2017-12-11 09:30:00' AS DATE)))' (binary and date).; line 1 pos 7 --- !query 131 +-- !query 109 SELECT IF(true, cast(1 as boolean), cast(2 as tinyint)) FROM t --- !query 131 schema +-- !query 109 schema struct<> --- !query 131 output +-- !query 109 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS TINYINT)))' (boolean and tinyint).; line 1 pos 7 --- !query 132 +-- !query 110 SELECT IF(true, cast(1 as boolean), cast(2 as smallint)) FROM t --- !query 132 schema -struct<> --- !query 132 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' (boolean and smallint).; line 1 pos 7 - - --- !query 133 -SELECT IF(true, cast(1 as boolean), cast(2 as short)) FROM t --- !query 133 schema +-- !query 110 schema struct<> --- !query 133 output +-- !query 110 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS SMALLINT)))' (boolean and smallint).; line 1 pos 7 --- !query 134 +-- !query 111 SELECT IF(true, cast(1 as boolean), cast(2 as int)) FROM t --- !query 134 schema +-- !query 111 schema struct<> --- !query 134 output +-- !query 111 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS INT)))' (boolean and int).; line 1 pos 7 --- !query 135 +-- !query 112 SELECT IF(true, cast(1 as boolean), cast(2 as bigint)) FROM t --- !query 135 schema +-- !query 112 schema struct<> --- !query 135 output +-- !query 112 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS BIGINT)))' (boolean and bigint).; line 1 pos 7 --- !query 136 +-- !query 113 SELECT IF(true, cast(1 as boolean), cast(2 as float)) FROM t --- !query 136 schema +-- !query 113 schema struct<> --- !query 136 output +-- !query 113 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS FLOAT)))' (boolean and float).; line 1 pos 7 --- !query 137 +-- !query 114 SELECT IF(true, cast(1 as boolean), cast(2 as double)) FROM t --- !query 137 schema +-- !query 114 schema struct<> --- !query 137 output +-- !query 114 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DOUBLE)))' (boolean and double).; line 1 pos 7 --- !query 138 +-- !query 115 SELECT IF(true, cast(1 as boolean), cast(2 as decimal(10, 0))) FROM t --- !query 138 schema +-- !query 115 schema struct<> --- !query 138 output +-- !query 115 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS DECIMAL(10,0))))' (boolean and decimal(10,0)).; line 1 pos 7 --- !query 139 +-- !query 116 SELECT IF(true, cast(1 as boolean), cast(2 as string)) FROM t --- !query 139 schema +-- !query 116 schema struct<> --- !query 139 output +-- !query 116 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS STRING)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS STRING)))' (boolean and string).; line 1 pos 7 --- !query 140 +-- !query 117 SELECT IF(true, cast(1 as boolean), cast('2' as binary)) FROM t --- !query 140 schema +-- !query 117 schema struct<> --- !query 140 output +-- !query 117 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST('2' AS BINARY)))' (boolean and binary).; line 1 pos 7 --- !query 141 +-- !query 118 SELECT IF(true, cast(1 as boolean), cast(2 as boolean)) FROM t --- !query 141 schema +-- !query 118 schema struct<(IF(true, CAST(1 AS BOOLEAN), CAST(2 AS BOOLEAN))):boolean> --- !query 141 output +-- !query 118 output true --- !query 142 +-- !query 119 SELECT IF(true, cast(1 as boolean), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 142 schema +-- !query 119 schema struct<> --- !query 142 output +-- !query 119 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00.0' AS TIMESTAMP)))' (boolean and timestamp).; line 1 pos 7 --- !query 143 +-- !query 120 SELECT IF(true, cast(1 as boolean), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 143 schema +-- !query 120 schema struct<> --- !query 143 output +-- !query 120 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00' AS DATE)))' due to data type mismatch: differing types in '(IF(true, CAST(1 AS BOOLEAN), CAST('2017-12-11 09:30:00' AS DATE)))' (boolean and date).; line 1 pos 7 --- !query 144 +-- !query 121 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as tinyint)) FROM t --- !query 144 schema +-- !query 121 schema struct<> --- !query 144 output +-- !query 121 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS TINYINT)))' (timestamp and tinyint).; line 1 pos 7 --- !query 145 +-- !query 122 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as smallint)) FROM t --- !query 145 schema -struct<> --- !query 145 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' (timestamp and smallint).; line 1 pos 7 - - --- !query 146 -SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as short)) FROM t --- !query 146 schema +-- !query 122 schema struct<> --- !query 146 output +-- !query 122 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS SMALLINT)))' (timestamp and smallint).; line 1 pos 7 --- !query 147 +-- !query 123 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as int)) FROM t --- !query 147 schema +-- !query 123 schema struct<> --- !query 147 output +-- !query 123 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS INT)))' (timestamp and int).; line 1 pos 7 --- !query 148 +-- !query 124 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as bigint)) FROM t --- !query 148 schema +-- !query 124 schema struct<> --- !query 148 output +-- !query 124 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BIGINT)))' (timestamp and bigint).; line 1 pos 7 --- !query 149 +-- !query 125 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as float)) FROM t --- !query 149 schema +-- !query 125 schema struct<> --- !query 149 output +-- !query 125 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS FLOAT)))' (timestamp and float).; line 1 pos 7 --- !query 150 +-- !query 126 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as double)) FROM t --- !query 150 schema +-- !query 126 schema struct<> --- !query 150 output +-- !query 126 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DOUBLE)))' (timestamp and double).; line 1 pos 7 --- !query 151 +-- !query 127 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as decimal(10, 0))) FROM t --- !query 151 schema +-- !query 127 schema struct<> --- !query 151 output +-- !query 127 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS DECIMAL(10,0))))' (timestamp and decimal(10,0)).; line 1 pos 7 --- !query 152 +-- !query 128 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as string)) FROM t --- !query 152 schema +-- !query 128 schema struct<(IF(true, CAST(CAST(2017-12-12 09:30:00.0 AS TIMESTAMP) AS STRING), CAST(2 AS STRING))):string> --- !query 152 output +-- !query 128 output 2017-12-12 09:30:00 --- !query 153 +-- !query 129 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2' as binary)) FROM t --- !query 153 schema +-- !query 129 schema struct<> --- !query 153 output +-- !query 129 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST('2' AS BINARY)))' (timestamp and binary).; line 1 pos 7 --- !query 154 +-- !query 130 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast(2 as boolean)) FROM t --- !query 154 schema +-- !query 130 schema struct<> --- !query 154 output +-- !query 130 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00.0' AS TIMESTAMP), CAST(2 AS BOOLEAN)))' (timestamp and boolean).; line 1 pos 7 --- !query 155 +-- !query 131 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 155 schema +-- !query 131 schema struct<(IF(true, CAST(2017-12-12 09:30:00.0 AS TIMESTAMP), CAST(2017-12-11 09:30:00.0 AS TIMESTAMP))):timestamp> --- !query 155 output +-- !query 131 output 2017-12-12 09:30:00 --- !query 156 +-- !query 132 SELECT IF(true, cast('2017-12-12 09:30:00.0' as timestamp), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 156 schema +-- !query 132 schema struct<(IF(true, CAST(2017-12-12 09:30:00.0 AS TIMESTAMP), CAST(CAST(2017-12-11 09:30:00 AS DATE) AS TIMESTAMP))):timestamp> --- !query 156 output +-- !query 132 output 2017-12-12 09:30:00 --- !query 157 +-- !query 133 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as tinyint)) FROM t --- !query 157 schema +-- !query 133 schema struct<> --- !query 157 output +-- !query 133 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS TINYINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS TINYINT)))' (date and tinyint).; line 1 pos 7 --- !query 158 +-- !query 134 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as smallint)) FROM t --- !query 158 schema -struct<> --- !query 158 output -org.apache.spark.sql.AnalysisException -cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' (date and smallint).; line 1 pos 7 - - --- !query 159 -SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as short)) FROM t --- !query 159 schema +-- !query 134 schema struct<> --- !query 159 output +-- !query 134 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS SMALLINT)))' (date and smallint).; line 1 pos 7 --- !query 160 +-- !query 135 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as int)) FROM t --- !query 160 schema +-- !query 135 schema struct<> --- !query 160 output +-- !query 135 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS INT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS INT)))' (date and int).; line 1 pos 7 --- !query 161 +-- !query 136 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as bigint)) FROM t --- !query 161 schema +-- !query 136 schema struct<> --- !query 161 output +-- !query 136 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BIGINT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BIGINT)))' (date and bigint).; line 1 pos 7 --- !query 162 +-- !query 137 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as float)) FROM t --- !query 162 schema +-- !query 137 schema struct<> --- !query 162 output +-- !query 137 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS FLOAT)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS FLOAT)))' (date and float).; line 1 pos 7 --- !query 163 +-- !query 138 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as double)) FROM t --- !query 163 schema +-- !query 138 schema struct<> --- !query 163 output +-- !query 138 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DOUBLE)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DOUBLE)))' (date and double).; line 1 pos 7 --- !query 164 +-- !query 139 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as decimal(10, 0))) FROM t --- !query 164 schema +-- !query 139 schema struct<> --- !query 164 output +-- !query 139 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DECIMAL(10,0))))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS DECIMAL(10,0))))' (date and decimal(10,0)).; line 1 pos 7 --- !query 165 +-- !query 140 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as string)) FROM t --- !query 165 schema +-- !query 140 schema struct<(IF(true, CAST(CAST(2017-12-12 09:30:00 AS DATE) AS STRING), CAST(2 AS STRING))):string> --- !query 165 output +-- !query 140 output 2017-12-12 --- !query 166 +-- !query 141 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2' as binary)) FROM t --- !query 166 schema +-- !query 141 schema struct<> --- !query 166 output +-- !query 141 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST('2' AS BINARY)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST('2' AS BINARY)))' (date and binary).; line 1 pos 7 --- !query 167 +-- !query 142 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast(2 as boolean)) FROM t --- !query 167 schema +-- !query 142 schema struct<> --- !query 167 output +-- !query 142 output org.apache.spark.sql.AnalysisException cannot resolve '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BOOLEAN)))' due to data type mismatch: differing types in '(IF(true, CAST('2017-12-12 09:30:00' AS DATE), CAST(2 AS BOOLEAN)))' (date and boolean).; line 1 pos 7 --- !query 168 +-- !query 143 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2017-12-11 09:30:00.0' as timestamp)) FROM t --- !query 168 schema +-- !query 143 schema struct<(IF(true, CAST(CAST(2017-12-12 09:30:00 AS DATE) AS TIMESTAMP), CAST(2017-12-11 09:30:00.0 AS TIMESTAMP))):timestamp> --- !query 168 output +-- !query 143 output 2017-12-12 00:00:00 --- !query 169 +-- !query 144 SELECT IF(true, cast('2017-12-12 09:30:00' as date), cast('2017-12-11 09:30:00' as date)) FROM t --- !query 169 schema +-- !query 144 schema struct<(IF(true, CAST(2017-12-12 09:30:00 AS DATE), CAST(2017-12-11 09:30:00 AS DATE))):date> --- !query 169 output +-- !query 144 output 2017-12-12