This is an automated email from the ASF dual-hosted git repository.
dongjoon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/spark.git
The following commit(s) were added to refs/heads/master by this push:
new 6c8bd94c5ed5 [SPARK-45915][SQL] Treat decimal(x, 0) the same as
IntegralType in `PromoteStrings`
6c8bd94c5ed5 is described below
commit 6c8bd94c5ed5aa806fc6cbf66ac83b1641f78694
Author: Yuming Wang <[email protected]>
AuthorDate: Wed Nov 15 02:43:37 2023 -0800
[SPARK-45915][SQL] Treat decimal(x, 0) the same as IntegralType in
`PromoteStrings`
### What changes were proposed in this pull request?
The common type of decimal(x, 0) and string is double. But the common type
of int/bigint and string are int/bigint.
This PR updates `PromoteStrings` make the common type of decimal(x, 0) and
string is decimal(x, 0).
### Why are the changes needed?
1. Make decimal(x, 0) behave the same as int/bigint in `PromoteStrings`.
2. Reduce one cast in binary comparison so we may use bucket read. For
example: `cast(stringCol as double) = cast(decimalCol as double)` vs
`cast(stringCol as decimal(x, 0)) = decimalCol`.
### Does this PR introduce _any_ user-facing change?
Yes. The result type of decimal(x, 0) and string is decimal(x, 0) in binary
comparison.
### How was this patch tested?
Unit test.
### Was this patch authored or co-authored using generative AI tooling?
No.
Closes #43812 from wangyum/SPARK-45915.
Authored-by: Yuming Wang <[email protected]>
Signed-off-by: Dongjoon Hyun <[email protected]>
---
.../spark/sql/catalyst/analysis/TypeCoercion.scala | 4 +-
.../sql/catalyst/analysis/TypeCoercionSuite.scala | 3 ++
.../typeCoercion/native/binaryComparison.sql.out | 48 +++++++++----------
.../typeCoercion/native/decimalPrecision.sql.out | 56 +++++++++++-----------
.../typeCoercion/native/promoteStrings.sql.out | 28 +++++------
5 files changed, 71 insertions(+), 68 deletions(-)
diff --git
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
index b34fd8736217..c5e98683c749 100644
---
a/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
+++
b/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercion.scala
@@ -934,8 +934,8 @@ object TypeCoercion extends TypeCoercionBase {
// There is no proper decimal type we can pick,
// using double type is the best we can do.
// See SPARK-22469 for details.
- case (n: DecimalType, s: StringType) => Some(DoubleType)
- case (s: StringType, n: DecimalType) => Some(DoubleType)
+ case (DecimalType.Fixed(_, s), _: StringType) if s > 0 => Some(DoubleType)
+ case (_: StringType, DecimalType.Fixed(_, s)) if s > 0 => Some(DoubleType)
case (l: StringType, r: AtomicType) if canPromoteAsInBinaryComparison(r)
=> Some(r)
case (l: AtomicType, r: StringType) if canPromoteAsInBinaryComparison(l)
=> Some(l)
diff --git
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionSuite.scala
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionSuite.scala
index 765920a1d00e..db86e7131446 100644
---
a/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionSuite.scala
+++
b/sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/analysis/TypeCoercionSuite.scala
@@ -1611,6 +1611,9 @@ class TypeCoercionSuite extends TypeCoercionSuiteBase {
GreaterThan(Literal("1.5"), Literal(BigDecimal("0.5"))),
GreaterThan(Cast(Literal("1.5"), DoubleType),
Cast(Literal(BigDecimal("0.5")),
DoubleType)))
+ ruleTest(rule,
+ GreaterThan(Literal("1.0"), Literal(BigDecimal("1"))),
+ GreaterThan(Cast(Literal("1.0"), DecimalType(1, 0)),
Literal(BigDecimal("1"))))
// Checks that dates/timestamps are not promoted to strings
val date0301 = Literal(java.sql.Date.valueOf("2017-03-01"))
val timestamp0301000000 = Literal(Timestamp.valueOf("2017-03-01 00:00:00"))
diff --git
a/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/binaryComparison.sql.out
b/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/binaryComparison.sql.out
index 6df9a4c21a9f..c2dfe61b259d 100644
---
a/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/binaryComparison.sql.out
+++
b/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/binaryComparison.sql.out
@@ -1330,7 +1330,7 @@ Project [NOT (cast(cast(null as string) as bigint) =
cast(1 as bigint)) AS (NOT
-- !query
SELECT cast(1 as decimal(10, 0)) = '1' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) = cast(1 as double)) AS
(CAST(1 AS DECIMAL(10,0)) = 1)#x]
+Project [(cast(1 as decimal(10,0)) = cast(1 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) = 1)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1341,7 +1341,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) =
cast(1 as double)) AS (CAST
-- !query
SELECT cast(1 as decimal(10, 0)) > '2' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) > cast(2 as double)) AS
(CAST(1 AS DECIMAL(10,0)) > 2)#x]
+Project [(cast(1 as decimal(10,0)) > cast(2 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) > 2)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1352,7 +1352,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) >
cast(2 as double)) AS (CAST
-- !query
SELECT cast(1 as decimal(10, 0)) >= '2' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) >= cast(2 as double)) AS
(CAST(1 AS DECIMAL(10,0)) >= 2)#x]
+Project [(cast(1 as decimal(10,0)) >= cast(2 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) >= 2)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1363,7 +1363,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) >=
cast(2 as double)) AS (CAS
-- !query
SELECT cast(1 as decimal(10, 0)) < '2' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) < cast(2 as double)) AS
(CAST(1 AS DECIMAL(10,0)) < 2)#x]
+Project [(cast(1 as decimal(10,0)) < cast(2 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) < 2)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1374,7 +1374,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) <
cast(2 as double)) AS (CAST
-- !query
SELECT cast(1 as decimal(10, 0)) <> '2' FROM t
-- !query analysis
-Project [NOT (cast(cast(1 as decimal(10,0)) as double) = cast(2 as double)) AS
(NOT (CAST(1 AS DECIMAL(10,0)) = 2))#x]
+Project [NOT (cast(1 as decimal(10,0)) = cast(2 as decimal(10,0))) AS (NOT
(CAST(1 AS DECIMAL(10,0)) = 2))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1385,7 +1385,7 @@ Project [NOT (cast(cast(1 as decimal(10,0)) as double) =
cast(2 as double)) AS (
-- !query
SELECT cast(1 as decimal(10, 0)) <= '2' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) <= cast(2 as double)) AS
(CAST(1 AS DECIMAL(10,0)) <= 2)#x]
+Project [(cast(1 as decimal(10,0)) <= cast(2 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) <= 2)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1396,7 +1396,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) <=
cast(2 as double)) AS (CAS
-- !query
SELECT cast(1 as decimal(10, 0)) = cast(null as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) = cast(cast(null as string)
as double)) AS (CAST(1 AS DECIMAL(10,0)) = CAST(NULL AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) = cast(cast(null as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) = CAST(NULL AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1407,7 +1407,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) =
cast(cast(null as string) a
-- !query
SELECT cast(1 as decimal(10, 0)) > cast(null as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) > cast(cast(null as string)
as double)) AS (CAST(1 AS DECIMAL(10,0)) > CAST(NULL AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) > cast(cast(null as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) > CAST(NULL AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1418,7 +1418,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) >
cast(cast(null as string) a
-- !query
SELECT cast(1 as decimal(10, 0)) >= cast(null as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) >= cast(cast(null as
string) as double)) AS (CAST(1 AS DECIMAL(10,0)) >= CAST(NULL AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) >= cast(cast(null as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) >= CAST(NULL AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1429,7 +1429,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) >=
cast(cast(null as string)
-- !query
SELECT cast(1 as decimal(10, 0)) < cast(null as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) < cast(cast(null as string)
as double)) AS (CAST(1 AS DECIMAL(10,0)) < CAST(NULL AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) < cast(cast(null as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) < CAST(NULL AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1440,7 +1440,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) <
cast(cast(null as string) a
-- !query
SELECT cast(1 as decimal(10, 0)) <> cast(null as string) FROM t
-- !query analysis
-Project [NOT (cast(cast(1 as decimal(10,0)) as double) = cast(cast(null as
string) as double)) AS (NOT (CAST(1 AS DECIMAL(10,0)) = CAST(NULL AS
STRING)))#x]
+Project [NOT (cast(1 as decimal(10,0)) = cast(cast(null as string) as
decimal(10,0))) AS (NOT (CAST(1 AS DECIMAL(10,0)) = CAST(NULL AS STRING)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1451,7 +1451,7 @@ Project [NOT (cast(cast(1 as decimal(10,0)) as double) =
cast(cast(null as strin
-- !query
SELECT cast(1 as decimal(10, 0)) <= cast(null as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) <= cast(cast(null as
string) as double)) AS (CAST(1 AS DECIMAL(10,0)) <= CAST(NULL AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) <= cast(cast(null as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) <= CAST(NULL AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1462,7 +1462,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) <=
cast(cast(null as string)
-- !query
SELECT '1' = cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(1 as double) = cast(cast(1 as decimal(10,0)) as double)) AS (1
= CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(1 as decimal(10,0)) = cast(1 as decimal(10,0))) AS (1 = CAST(1
AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1473,7 +1473,7 @@ Project [(cast(1 as double) = cast(cast(1 as
decimal(10,0)) as double)) AS (1 =
-- !query
SELECT '2' > cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(2 as double) > cast(cast(1 as decimal(10,0)) as double)) AS (2
> CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(2 as decimal(10,0)) > cast(1 as decimal(10,0))) AS (2 > CAST(1
AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1484,7 +1484,7 @@ Project [(cast(2 as double) > cast(cast(1 as
decimal(10,0)) as double)) AS (2 >
-- !query
SELECT '2' >= cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(2 as double) >= cast(cast(1 as decimal(10,0)) as double)) AS (2
>= CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(2 as decimal(10,0)) >= cast(1 as decimal(10,0))) AS (2 >=
CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1495,7 +1495,7 @@ Project [(cast(2 as double) >= cast(cast(1 as
decimal(10,0)) as double)) AS (2 >
-- !query
SELECT '2' < cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(2 as double) < cast(cast(1 as decimal(10,0)) as double)) AS (2
< CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(2 as decimal(10,0)) < cast(1 as decimal(10,0))) AS (2 < CAST(1
AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1506,7 +1506,7 @@ Project [(cast(2 as double) < cast(cast(1 as
decimal(10,0)) as double)) AS (2 <
-- !query
SELECT '2' <= cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(2 as double) <= cast(cast(1 as decimal(10,0)) as double)) AS (2
<= CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(2 as decimal(10,0)) <= cast(1 as decimal(10,0))) AS (2 <=
CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1517,7 +1517,7 @@ Project [(cast(2 as double) <= cast(cast(1 as
decimal(10,0)) as double)) AS (2 <
-- !query
SELECT '2' <> cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [NOT (cast(2 as double) = cast(cast(1 as decimal(10,0)) as double)) AS
(NOT (2 = CAST(1 AS DECIMAL(10,0))))#x]
+Project [NOT (cast(2 as decimal(10,0)) = cast(1 as decimal(10,0))) AS (NOT (2
= CAST(1 AS DECIMAL(10,0))))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1528,7 +1528,7 @@ Project [NOT (cast(2 as double) = cast(cast(1 as
decimal(10,0)) as double)) AS (
-- !query
SELECT cast(null as string) = cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(cast(null as string) as double) = cast(cast(1 as decimal(10,0))
as double)) AS (CAST(NULL AS STRING) = CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(cast(null as string) as decimal(10,0)) = cast(1 as
decimal(10,0))) AS (CAST(NULL AS STRING) = CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1539,7 +1539,7 @@ Project [(cast(cast(null as string) as double) =
cast(cast(1 as decimal(10,0)) a
-- !query
SELECT cast(null as string) > cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(cast(null as string) as double) > cast(cast(1 as decimal(10,0))
as double)) AS (CAST(NULL AS STRING) > CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(cast(null as string) as decimal(10,0)) > cast(1 as
decimal(10,0))) AS (CAST(NULL AS STRING) > CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1550,7 +1550,7 @@ Project [(cast(cast(null as string) as double) >
cast(cast(1 as decimal(10,0)) a
-- !query
SELECT cast(null as string) >= cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(cast(null as string) as double) >= cast(cast(1 as
decimal(10,0)) as double)) AS (CAST(NULL AS STRING) >= CAST(1 AS
DECIMAL(10,0)))#x]
+Project [(cast(cast(null as string) as decimal(10,0)) >= cast(1 as
decimal(10,0))) AS (CAST(NULL AS STRING) >= CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1561,7 +1561,7 @@ Project [(cast(cast(null as string) as double) >=
cast(cast(1 as decimal(10,0))
-- !query
SELECT cast(null as string) < cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(cast(null as string) as double) < cast(cast(1 as decimal(10,0))
as double)) AS (CAST(NULL AS STRING) < CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(cast(null as string) as decimal(10,0)) < cast(1 as
decimal(10,0))) AS (CAST(NULL AS STRING) < CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1572,7 +1572,7 @@ Project [(cast(cast(null as string) as double) <
cast(cast(1 as decimal(10,0)) a
-- !query
SELECT cast(null as string) <= cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(cast(null as string) as double) <= cast(cast(1 as
decimal(10,0)) as double)) AS (CAST(NULL AS STRING) <= CAST(1 AS
DECIMAL(10,0)))#x]
+Project [(cast(cast(null as string) as decimal(10,0)) <= cast(1 as
decimal(10,0))) AS (CAST(NULL AS STRING) <= CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -1583,7 +1583,7 @@ Project [(cast(cast(null as string) as double) <=
cast(cast(1 as decimal(10,0))
-- !query
SELECT cast(null as string) <> cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [NOT (cast(cast(null as string) as double) = cast(cast(1 as
decimal(10,0)) as double)) AS (NOT (CAST(NULL AS STRING) = CAST(1 AS
DECIMAL(10,0))))#x]
+Project [NOT (cast(cast(null as string) as decimal(10,0)) = cast(1 as
decimal(10,0))) AS (NOT (CAST(NULL AS STRING) = CAST(1 AS DECIMAL(10,0))))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
diff --git
a/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/decimalPrecision.sql.out
b/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/decimalPrecision.sql.out
index 0ab4530c6b96..5fd5c1fa5740 100644
---
a/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/decimalPrecision.sql.out
+++
b/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/decimalPrecision.sql.out
@@ -8594,7 +8594,7 @@ Project [(cast(1 as decimal(20,0)) = cast(cast(1 as
decimal(10,0)) as decimal(20
-- !query
SELECT cast(1 as decimal(3, 0)) = cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(3,0)) as double) = cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(3,0)) = CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(3,0)) = cast(cast(1 as string) as decimal(3,0)))
AS (CAST(1 AS DECIMAL(3,0)) = CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -8605,7 +8605,7 @@ Project [(cast(cast(1 as decimal(3,0)) as double) =
cast(cast(1 as string) as do
-- !query
SELECT cast(1 as decimal(5, 0)) = cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(5,0)) as double) = cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(5,0)) = CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(5,0)) = cast(cast(1 as string) as decimal(5,0)))
AS (CAST(1 AS DECIMAL(5,0)) = CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -8616,7 +8616,7 @@ Project [(cast(cast(1 as decimal(5,0)) as double) =
cast(cast(1 as string) as do
-- !query
SELECT cast(1 as decimal(10, 0)) = cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) = cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(10,0)) = CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) = cast(cast(1 as string) as decimal(10,0)))
AS (CAST(1 AS DECIMAL(10,0)) = CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -8627,7 +8627,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) =
cast(cast(1 as string) as d
-- !query
SELECT cast(1 as decimal(20, 0)) = cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(20,0)) as double) = cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(20,0)) = CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(20,0)) = cast(cast(1 as string) as decimal(20,0)))
AS (CAST(1 AS DECIMAL(20,0)) = CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -9826,7 +9826,7 @@ Project [(cast(1 as decimal(20,0)) <=> cast(cast(1 as
decimal(10,0)) as decimal(
-- !query
SELECT cast(1 as decimal(3, 0)) <=> cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(3,0)) as double) <=> cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(3,0)) <=> CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(3,0)) <=> cast(cast(1 as string) as decimal(3,0)))
AS (CAST(1 AS DECIMAL(3,0)) <=> CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -9837,7 +9837,7 @@ Project [(cast(cast(1 as decimal(3,0)) as double) <=>
cast(cast(1 as string) as
-- !query
SELECT cast(1 as decimal(5, 0)) <=> cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(5,0)) as double) <=> cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(5,0)) <=> CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(5,0)) <=> cast(cast(1 as string) as decimal(5,0)))
AS (CAST(1 AS DECIMAL(5,0)) <=> CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -9848,7 +9848,7 @@ Project [(cast(cast(1 as decimal(5,0)) as double) <=>
cast(cast(1 as string) as
-- !query
SELECT cast(1 as decimal(10, 0)) <=> cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) <=> cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(10,0)) <=> CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) <=> cast(cast(1 as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) <=> CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -9859,7 +9859,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) <=>
cast(cast(1 as string) as
-- !query
SELECT cast(1 as decimal(20, 0)) <=> cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(20,0)) as double) <=> cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(20,0)) <=> CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(20,0)) <=> cast(cast(1 as string) as
decimal(20,0))) AS (CAST(1 AS DECIMAL(20,0)) <=> CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -11058,7 +11058,7 @@ Project [(cast(1 as decimal(20,0)) < cast(cast(1 as
decimal(10,0)) as decimal(20
-- !query
SELECT cast(1 as decimal(3, 0)) < cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(3,0)) as double) < cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(3,0)) < CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(3,0)) < cast(cast(1 as string) as decimal(3,0)))
AS (CAST(1 AS DECIMAL(3,0)) < CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -11069,7 +11069,7 @@ Project [(cast(cast(1 as decimal(3,0)) as double) <
cast(cast(1 as string) as do
-- !query
SELECT cast(1 as decimal(5, 0)) < cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(5,0)) as double) < cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(5,0)) < CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(5,0)) < cast(cast(1 as string) as decimal(5,0)))
AS (CAST(1 AS DECIMAL(5,0)) < CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -11080,7 +11080,7 @@ Project [(cast(cast(1 as decimal(5,0)) as double) <
cast(cast(1 as string) as do
-- !query
SELECT cast(1 as decimal(10, 0)) < cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) < cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(10,0)) < CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) < cast(cast(1 as string) as decimal(10,0)))
AS (CAST(1 AS DECIMAL(10,0)) < CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -11091,7 +11091,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) <
cast(cast(1 as string) as d
-- !query
SELECT cast(1 as decimal(20, 0)) < cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(20,0)) as double) < cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(20,0)) < CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(20,0)) < cast(cast(1 as string) as decimal(20,0)))
AS (CAST(1 AS DECIMAL(20,0)) < CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -12334,7 +12334,7 @@ Project [(cast(1 as decimal(20,0)) <= cast(cast(1 as
decimal(10,0)) as decimal(2
-- !query
SELECT cast(1 as decimal(3, 0)) <= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(3,0)) as double) <= cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(3,0)) <= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(3,0)) <= cast(cast(1 as string) as decimal(3,0)))
AS (CAST(1 AS DECIMAL(3,0)) <= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -12345,7 +12345,7 @@ Project [(cast(cast(1 as decimal(3,0)) as double) <=
cast(cast(1 as string) as d
-- !query
SELECT cast(1 as decimal(5, 0)) <= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(5,0)) as double) <= cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(5,0)) <= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(5,0)) <= cast(cast(1 as string) as decimal(5,0)))
AS (CAST(1 AS DECIMAL(5,0)) <= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -12356,7 +12356,7 @@ Project [(cast(cast(1 as decimal(5,0)) as double) <=
cast(cast(1 as string) as d
-- !query
SELECT cast(1 as decimal(10, 0)) <= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) <= cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(10,0)) <= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) <= cast(cast(1 as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) <= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -12367,7 +12367,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) <=
cast(cast(1 as string) as
-- !query
SELECT cast(1 as decimal(20, 0)) <= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(20,0)) as double) <= cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(20,0)) <= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(20,0)) <= cast(cast(1 as string) as
decimal(20,0))) AS (CAST(1 AS DECIMAL(20,0)) <= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -13610,7 +13610,7 @@ Project [(cast(1 as decimal(20,0)) > cast(cast(1 as
decimal(10,0)) as decimal(20
-- !query
SELECT cast(1 as decimal(3, 0)) > cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(3,0)) as double) > cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(3,0)) > CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(3,0)) > cast(cast(1 as string) as decimal(3,0)))
AS (CAST(1 AS DECIMAL(3,0)) > CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -13621,7 +13621,7 @@ Project [(cast(cast(1 as decimal(3,0)) as double) >
cast(cast(1 as string) as do
-- !query
SELECT cast(1 as decimal(5, 0)) > cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(5,0)) as double) > cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(5,0)) > CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(5,0)) > cast(cast(1 as string) as decimal(5,0)))
AS (CAST(1 AS DECIMAL(5,0)) > CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -13632,7 +13632,7 @@ Project [(cast(cast(1 as decimal(5,0)) as double) >
cast(cast(1 as string) as do
-- !query
SELECT cast(1 as decimal(10, 0)) > cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) > cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(10,0)) > CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) > cast(cast(1 as string) as decimal(10,0)))
AS (CAST(1 AS DECIMAL(10,0)) > CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -13643,7 +13643,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) >
cast(cast(1 as string) as d
-- !query
SELECT cast(1 as decimal(20, 0)) > cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(20,0)) as double) > cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(20,0)) > CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(20,0)) > cast(cast(1 as string) as decimal(20,0)))
AS (CAST(1 AS DECIMAL(20,0)) > CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -14886,7 +14886,7 @@ Project [(cast(1 as decimal(20,0)) >= cast(cast(1 as
decimal(10,0)) as decimal(2
-- !query
SELECT cast(1 as decimal(3, 0)) >= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(3,0)) as double) >= cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(3,0)) >= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(3,0)) >= cast(cast(1 as string) as decimal(3,0)))
AS (CAST(1 AS DECIMAL(3,0)) >= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -14897,7 +14897,7 @@ Project [(cast(cast(1 as decimal(3,0)) as double) >=
cast(cast(1 as string) as d
-- !query
SELECT cast(1 as decimal(5, 0)) >= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(5,0)) as double) >= cast(cast(1 as string) as
double)) AS (CAST(1 AS DECIMAL(5,0)) >= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(5,0)) >= cast(cast(1 as string) as decimal(5,0)))
AS (CAST(1 AS DECIMAL(5,0)) >= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -14908,7 +14908,7 @@ Project [(cast(cast(1 as decimal(5,0)) as double) >=
cast(cast(1 as string) as d
-- !query
SELECT cast(1 as decimal(10, 0)) >= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) >= cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(10,0)) >= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(10,0)) >= cast(cast(1 as string) as
decimal(10,0))) AS (CAST(1 AS DECIMAL(10,0)) >= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -14919,7 +14919,7 @@ Project [(cast(cast(1 as decimal(10,0)) as double) >=
cast(cast(1 as string) as
-- !query
SELECT cast(1 as decimal(20, 0)) >= cast(1 as string) FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(20,0)) as double) >= cast(cast(1 as string)
as double)) AS (CAST(1 AS DECIMAL(20,0)) >= CAST(1 AS STRING))#x]
+Project [(cast(1 as decimal(20,0)) >= cast(cast(1 as string) as
decimal(20,0))) AS (CAST(1 AS DECIMAL(20,0)) >= CAST(1 AS STRING))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -16162,7 +16162,7 @@ Project [NOT (cast(1 as decimal(20,0)) = cast(cast(1 as
decimal(10,0)) as decima
-- !query
SELECT cast(1 as decimal(3, 0)) <> cast(1 as string) FROM t
-- !query analysis
-Project [NOT (cast(cast(1 as decimal(3,0)) as double) = cast(cast(1 as string)
as double)) AS (NOT (CAST(1 AS DECIMAL(3,0)) = CAST(1 AS STRING)))#x]
+Project [NOT (cast(1 as decimal(3,0)) = cast(cast(1 as string) as
decimal(3,0))) AS (NOT (CAST(1 AS DECIMAL(3,0)) = CAST(1 AS STRING)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -16173,7 +16173,7 @@ Project [NOT (cast(cast(1 as decimal(3,0)) as double) =
cast(cast(1 as string) a
-- !query
SELECT cast(1 as decimal(5, 0)) <> cast(1 as string) FROM t
-- !query analysis
-Project [NOT (cast(cast(1 as decimal(5,0)) as double) = cast(cast(1 as string)
as double)) AS (NOT (CAST(1 AS DECIMAL(5,0)) = CAST(1 AS STRING)))#x]
+Project [NOT (cast(1 as decimal(5,0)) = cast(cast(1 as string) as
decimal(5,0))) AS (NOT (CAST(1 AS DECIMAL(5,0)) = CAST(1 AS STRING)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -16184,7 +16184,7 @@ Project [NOT (cast(cast(1 as decimal(5,0)) as double) =
cast(cast(1 as string) a
-- !query
SELECT cast(1 as decimal(10, 0)) <> cast(1 as string) FROM t
-- !query analysis
-Project [NOT (cast(cast(1 as decimal(10,0)) as double) = cast(cast(1 as
string) as double)) AS (NOT (CAST(1 AS DECIMAL(10,0)) = CAST(1 AS STRING)))#x]
+Project [NOT (cast(1 as decimal(10,0)) = cast(cast(1 as string) as
decimal(10,0))) AS (NOT (CAST(1 AS DECIMAL(10,0)) = CAST(1 AS STRING)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -16195,7 +16195,7 @@ Project [NOT (cast(cast(1 as decimal(10,0)) as double)
= cast(cast(1 as string)
-- !query
SELECT cast(1 as decimal(20, 0)) <> cast(1 as string) FROM t
-- !query analysis
-Project [NOT (cast(cast(1 as decimal(20,0)) as double) = cast(cast(1 as
string) as double)) AS (NOT (CAST(1 AS DECIMAL(20,0)) = CAST(1 AS STRING)))#x]
+Project [NOT (cast(1 as decimal(20,0)) = cast(cast(1 as string) as
decimal(20,0))) AS (NOT (CAST(1 AS DECIMAL(20,0)) = CAST(1 AS STRING)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
diff --git
a/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/promoteStrings.sql.out
b/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/promoteStrings.sql.out
index d18d070e54e9..dad6e815e93d 100644
---
a/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/promoteStrings.sql.out
+++
b/sql/core/src/test/resources/sql-tests/analyzer-results/typeCoercion/native/promoteStrings.sql.out
@@ -2121,7 +2121,7 @@ Project [(cast(1 as double) = cast(1 as double)) AS (1 =
CAST(1 AS DOUBLE))#x]
-- !query
SELECT '1' = cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(1 as double) = cast(cast(1 as decimal(10,0)) as double)) AS (1
= CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(1 as decimal(10,0)) = cast(1 as decimal(10,0))) AS (1 = CAST(1
AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -2253,7 +2253,7 @@ Project [(cast(1 as double) = cast(1 as double)) AS
(CAST(1 AS DOUBLE) = 1)#x]
-- !query
SELECT cast(1 as decimal(10, 0)) = '1' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) = cast(1 as double)) AS
(CAST(1 AS DECIMAL(10,0)) = 1)#x]
+Project [(cast(1 as decimal(10,0)) = cast(1 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) = 1)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -2374,7 +2374,7 @@ Project [(cast(1 as double) <=> cast(1 as double)) AS (1
<=> CAST(1 AS DOUBLE))#
-- !query
SELECT '1' <=> cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(1 as double) <=> cast(cast(1 as decimal(10,0)) as double)) AS
(1 <=> CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(1 as decimal(10,0)) <=> cast(1 as decimal(10,0))) AS (1 <=>
CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -2506,7 +2506,7 @@ Project [(cast(1 as double) <=> cast(1 as double)) AS
(CAST(1 AS DOUBLE) <=> 1)#
-- !query
SELECT cast(1 as decimal(10, 0)) <=> '1' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) <=> cast(1 as double)) AS
(CAST(1 AS DECIMAL(10,0)) <=> 1)#x]
+Project [(cast(1 as decimal(10,0)) <=> cast(1 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) <=> 1)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -2627,7 +2627,7 @@ Project [(cast(1 as double) < cast(1 as double)) AS (1 <
CAST(1 AS DOUBLE))#x]
-- !query
SELECT '1' < cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(1 as double) < cast(cast(1 as decimal(10,0)) as double)) AS (1
< CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(1 as decimal(10,0)) < cast(1 as decimal(10,0))) AS (1 < CAST(1
AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -2759,7 +2759,7 @@ Project [(cast(1 as double) <= cast(1 as double)) AS (1
<= CAST(1 AS DOUBLE))#x]
-- !query
SELECT '1' <= cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(1 as double) <= cast(cast(1 as decimal(10,0)) as double)) AS (1
<= CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(1 as decimal(10,0)) <= cast(1 as decimal(10,0))) AS (1 <=
CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -2891,7 +2891,7 @@ Project [(cast(1 as double) > cast(1 as double)) AS (1 >
CAST(1 AS DOUBLE))#x]
-- !query
SELECT '1' > cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(1 as double) > cast(cast(1 as decimal(10,0)) as double)) AS (1
> CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(1 as decimal(10,0)) > cast(1 as decimal(10,0))) AS (1 > CAST(1
AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -3023,7 +3023,7 @@ Project [(cast(1 as double) >= cast(1 as double)) AS (1
>= CAST(1 AS DOUBLE))#x]
-- !query
SELECT '1' >= cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [(cast(1 as double) >= cast(cast(1 as decimal(10,0)) as double)) AS (1
>= CAST(1 AS DECIMAL(10,0)))#x]
+Project [(cast(1 as decimal(10,0)) >= cast(1 as decimal(10,0))) AS (1 >=
CAST(1 AS DECIMAL(10,0)))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -3155,7 +3155,7 @@ Project [NOT (cast(1 as double) = cast(1 as double)) AS
(NOT (1 = CAST(1 AS DOUB
-- !query
SELECT '1' <> cast(1 as decimal(10, 0)) FROM t
-- !query analysis
-Project [NOT (cast(1 as double) = cast(cast(1 as decimal(10,0)) as double)) AS
(NOT (1 = CAST(1 AS DECIMAL(10,0))))#x]
+Project [NOT (cast(1 as decimal(10,0)) = cast(1 as decimal(10,0))) AS (NOT (1
= CAST(1 AS DECIMAL(10,0))))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -3287,7 +3287,7 @@ Project [(cast(1 as double) < cast(1 as double)) AS
(CAST(1 AS DOUBLE) < 1)#x]
-- !query
SELECT cast(1 as decimal(10, 0)) < '1' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) < cast(1 as double)) AS
(CAST(1 AS DECIMAL(10,0)) < 1)#x]
+Project [(cast(1 as decimal(10,0)) < cast(1 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) < 1)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -3419,7 +3419,7 @@ Project [(cast(1 as double) <= cast(1 as double)) AS
(CAST(1 AS DOUBLE) <= 1)#x]
-- !query
SELECT cast(1 as decimal(10, 0)) <= '1' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) <= cast(1 as double)) AS
(CAST(1 AS DECIMAL(10,0)) <= 1)#x]
+Project [(cast(1 as decimal(10,0)) <= cast(1 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) <= 1)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -3551,7 +3551,7 @@ Project [(cast(1 as double) > cast(1 as double)) AS
(CAST(1 AS DOUBLE) > 1)#x]
-- !query
SELECT cast(1 as decimal(10, 0)) > '1' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) > cast(1 as double)) AS
(CAST(1 AS DECIMAL(10,0)) > 1)#x]
+Project [(cast(1 as decimal(10,0)) > cast(1 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) > 1)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -3683,7 +3683,7 @@ Project [(cast(1 as double) >= cast(1 as double)) AS
(CAST(1 AS DOUBLE) >= 1)#x]
-- !query
SELECT cast(1 as decimal(10, 0)) >= '1' FROM t
-- !query analysis
-Project [(cast(cast(1 as decimal(10,0)) as double) >= cast(1 as double)) AS
(CAST(1 AS DECIMAL(10,0)) >= 1)#x]
+Project [(cast(1 as decimal(10,0)) >= cast(1 as decimal(10,0))) AS (CAST(1 AS
DECIMAL(10,0)) >= 1)#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
@@ -3815,7 +3815,7 @@ Project [NOT (cast(1 as double) = cast(1 as double)) AS
(NOT (CAST(1 AS DOUBLE)
-- !query
SELECT cast(1 as decimal(10, 0)) <> '1' FROM t
-- !query analysis
-Project [NOT (cast(cast(1 as decimal(10,0)) as double) = cast(1 as double)) AS
(NOT (CAST(1 AS DECIMAL(10,0)) = 1))#x]
+Project [NOT (cast(1 as decimal(10,0)) = cast(1 as decimal(10,0))) AS (NOT
(CAST(1 AS DECIMAL(10,0)) = 1))#x]
+- SubqueryAlias t
+- View (`t`, [1#x])
+- Project [cast(1#x as int) AS 1#x]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]