This is an automated email from the ASF dual-hosted git repository. jhyde pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/calcite.git
commit c3f3decd39c29d85bd5ec659ebcec853e2f337ff Author: snuyanzin <[email protected]> AuthorDate: Tue Sep 28 02:03:50 2021 +0200 [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 --- core/src/test/java/org/apache/calcite/test/JdbcTest.java | 11 +++++++++++ 1 file changed, 11 insertions(+) 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 @@ public class JdbcTest { .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++) {
