Details
Description
Wrong numers cast with operators like UNION / INTERSECT / EXCEPT.
Reproducer:
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(); }
Error:
java.lang.AssertionError: Collections sizes are not equal: Expected: [[10]] Actual: [[10], [10]]
Or:
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(); }
Error:
java.lang.AssertionError: Collections sizes are not equal: Expected: [[10], [20], [50]] Actual: []
Adoption of #IGNITE-21827 and #IGNITE-20649
Attachments
Issue Links
- relates to
-
IGNITE-20649 SQL: class cast exception in EXCEPT SELECT with different column types
- Resolved
-
IGNITE-21827 Sql. Union returns incorrect result for DECIMAL and INT columns
- Resolved
- links to