Vladimir Steshin created IGNITE-23308:
-----------------------------------------
Summary: Calcite. Wrong type coercion with set-op operations.
Key: IGNITE-23308
URL: https://issues.apache.org/jira/browse/IGNITE-23308
Project: Ignite
Issue Type: Bug
Reporter: Vladimir Steshin
Wrong numers cast with operators like _UNION_ / _INTERSECT_ / EXCEPT.
Reproducer:
{code:java}
public void testUnionWithNumerics() {
sql("CREATE TABLE t0(id INT PRIMARY KEY, val INT)");
sql("CREATE TABLE t1(id INT PRIMARY KEY, val DECIMAL)");
sql("INSERT INTO t0 VALUES (1, 10)");
sql("INSERT INTO t1 VALUES (1, 10)");
assertQuery(ignite(0), "SELECT val from t0 UNION select val from t1")
.returns(new BigDecimal(10))
.ordered()
.check();
}
{code}
Error:
{code:java}
java.lang.AssertionError: Collections sizes are not equal:
Expected: [[10]]
Actual: [[10], [10]]
{code}
Or:
{code:java}
public void testIntersectWithNumerics() {
sql("CREATE TABLE t0(id INT PRIMARY KEY, val INT)");
sql("CREATE TABLE t1(id INT PRIMARY KEY, val DECIMAL)");
sql("INSERT INTO t0 VALUES (1, 10), (2, 20), (3, 30), (4, 40), (5,
50)");
sql("INSERT INTO t1 VALUES (1, 10), (2, 20), (3, 300), (4, 400), (5,
50)");
assertQuery(ignite(0), "SELECT val from t0 INTERSECT select val from
t1")
.returns(new BigDecimal(10))
.returns(new BigDecimal(20))
.returns(new BigDecimal(50))
.ordered()
.check();
}
{code}
Error:
{code:java}
java.lang.AssertionError: Collections sizes are not equal:
Expected: [[10], [20], [50]]
Actual: []
{code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)