You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2024/04/04 21:26:00 UTC
[jira] [Commented] (CALCITE-6353) Optimization CoreRules.PROJECT_REDUCE_EXPRESSIONS crashes while optimizing ARRAY_CONCAT expression
[ https://issues.apache.org/jira/browse/CALCITE-6353?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17834084#comment-17834084 ]
Mihai Budiu commented on CALCITE-6353:
--------------------------------------
This actually is a combination of 3 bugs. Two are in the ArrayConcatImplementor, which does not generate legal Java, and the third one is in the simplifier itself (ReduceExpressionsRule), which doesn't know how to simplify casts of arrays.
> Optimization CoreRules.PROJECT_REDUCE_EXPRESSIONS crashes while optimizing ARRAY_CONCAT expression
> --------------------------------------------------------------------------------------------------
>
> Key: CALCITE-6353
> URL: https://issues.apache.org/jira/browse/CALCITE-6353
> Project: Calcite
> Issue Type: Bug
> Components: core
> Affects Versions: 1.36.0
> Reporter: Mihai Budiu
> Priority: Minor
>
> The following RelOptRulesTest
> {code:java}
> @Test void testArrayConcat() {
> final String sql = "select array_concat(ARRAY [1, 2], ARRAY [3, 4])";
> sql(sql).withFactory(
> t -> t.withOperatorTable(
> opTab -> SqlLibraryOperatorTableFactory.INSTANCE.getOperatorTable(
> SqlLibrary.STANDARD, SqlLibrary.BIG_QUERY)))
> .withRule(CoreRules.PROJECT_REDUCE_EXPRESSIONS)
> .check();
> }
> {code}
> crashes with the following stack trace:
> {code:java}
> java.lang.RuntimeException: While compiling [ARRAY_CONCAT(ARRAY(1, 2), ARRAY(3, 4))]
> at org.apache.calcite.rex.RexExecutable.compile(RexExecutable.java:73)
> at org.apache.calcite.rex.RexExecutable.<init>(RexExecutable.java:53)
> at org.apache.calcite.rex.RexExecutorImpl.reduce(RexExecutorImpl.java:145)
> at org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressionsInternal(ReduceExpressionsRule.java:774)
> at org.apache.calcite.rel.rules.ReduceExpressionsRule.reduceExpressions(ReduceExpressionsRule.java:714)
> {code}
> It seems that the generated code passed to Janino is invalid:
> Line 10, Column 5: Assignment conversion not possible from type "java.util.ArrayList" to type "java.lang.Object[]"
> org.codehaus.commons.compiler.CompileException: Line 10, Column 5: Assignment conversion not possible from type "java.util.ArrayList" to type "java.lang.Object[]"
--
This message was sent by Atlassian Jira
(v8.20.10#820010)