You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Mihai Budiu (Jira)" <ji...@apache.org> on 2024/04/04 20:36:00 UTC

[jira] [Created] (CALCITE-6353) Optimization CoreRules.PROJECT_REDUCE_EXPRESSIONS crashes while optimizing ARRAY_CONCAT expression

Mihai Budiu created CALCITE-6353:
------------------------------------

             Summary: 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


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)