[CALCITE-4602] ClassCastException retrieving from ARRAY that has mixed INTEGER and DECIMAL elements
Now that we have upgraded Calcite to Avatica 1.19, which
fixes [CALCITE-4602], we can add this test case to Calcite.
The fix is not perfect: the ClassCastException has gone, but
the resulting BigDecimal value is wrong; [CALCITE-4850] is
logged for that.
Close apache/calcite#2547
diff --git a/core/src/test/java/org/apache/calcite/test/JdbcTest.java b/core/src/test/java/org/apache/calcite/test/JdbcTest.java
index 02a1465..19804b6 100644
--- a/core/src/test/java/org/apache/calcite/test/JdbcTest.java
+++ b/core/src/test/java/org/apache/calcite/test/JdbcTest.java
@@ -7765,6 +7765,17 @@
.returns("EXPR$0=[1900-01-01]\n");
}
+ /** Test case for
+ * <a href="https://issues.apache.org/jira/browse/CALCITE-4602">[CALCITE-4602]
+ * ClassCastException retrieving from ARRAY that has mixed INTEGER and DECIMAL
+ * elements</a>. */
+ @Test public void testIntAndBigDecimalInArray() {
+ // Result should be "EXPR$0=[1, 1.1]\n"; [CALCITE-4850] logged.
+ CalciteAssert.that()
+ .query("select array[1, 1.1]")
+ .returns("EXPR$0=[0E+1, 1.1]\n");
+ }
+
private static String sums(int n, boolean c) {
final StringBuilder b = new StringBuilder();
for (int i = 0; i < n; i++) {