[ 
https://issues.apache.org/jira/browse/CALCITE-3052?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Anton Haidai updated CALCITE-3052:
----------------------------------
    Description: 
*Materialized views enabled:*
# "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from 
students group by team"
# "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, 
faculty from students group by faculty, team",

*Query:*
# "select count(*), team from students group by team"

*Error* (stacktrace is obtained using the current *master* branch: 
"247c7d4f76"):
{code}
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
        at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60)
        at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841)
        at 
org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507)
        at 
org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522)
        at 
org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776)
        at 
org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208)
        ... 71 common frames omitted
{code}

Reproducible only if both Materialization views listed are enabled: any single 
one of these two could be successfully used with the query without any errors. 
Currently, I'm trying to reproduce the issue in "MaterializationTest": without 
a success so far, I'll update the ticket if I'll find a working way to 
reproduce the issue in the test will be discovered.

  was:
*Materialized views enabled:*
# "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from 
students group by team"
# "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, 
faculty from students group by faculty, team",

*Query:*
# "select count(*), team from students group by team"

*Error* (stacktrace is obtained using the current *master* branch: 
"247c7d4f76"):
{code}
at 
org.apache.calcite.prepare.ZEnginePreparingStmt.optimize(ZEnginePreparingStmt.java:311)
        at 
org.apache.calcite.prepare.ZEnginePreparingStmt.prepare_(ZEnginePreparingStmt.java:195)
        at 
org.apache.calcite.prepare.ZEnginePreparingStmt.prepareRel(ZEnginePreparingStmt.java:142)
        at 
org.apache.calcite.prepare.ZEnginePrepareImpl.prepare2_(ZEnginePrepareImpl.java:424)
        at 
org.apache.calcite.prepare.ZEnginePrepareImpl.prepareSql(ZEnginePrepareImpl.java:108)
        ... 55 common frames omitted
Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
        at 
com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60)
        at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841)
        at 
org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507)
        at 
org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522)
        at 
org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776)
        at 
org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208)
        ... 71 common frames omitted
{code}

Reproducible only if both Materialization views listed are enabled: any single 
one of these two could be successfully used with the query without any errors. 
Currently, I'm trying to reproduce the issue in "MaterializationTest": without 
a success so far, I'll update the ticket if I'll find a working way to 
reproduce the issue in the test will be discovered.


> Error while applying rule MaterializedViewAggregateRule(Project-Aggregate): 
> ArrayIndexOutOfBoundsException
> ----------------------------------------------------------------------------------------------------------
>
>                 Key: CALCITE-3052
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3052
>             Project: Calcite
>          Issue Type: Bug
>    Affects Versions: 1.19.0
>            Reporter: Anton Haidai
>            Priority: Major
>
> *Materialized views enabled:*
> # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team from 
> students group by team"
> # "select avg(grade), count(*), max(grade), sum(grade), min(grade), team, 
> faculty from students group by faculty, team",
> *Query:*
> # "select count(*), team from students group by team"
> *Error* (stacktrace is obtained using the current *master* branch: 
> "247c7d4f76"):
> {code}
> Caused by: java.lang.ArrayIndexOutOfBoundsException: 2
>       at 
> com.google.common.collect.RegularImmutableList.get(RegularImmutableList.java:60)
>       at org.apache.calcite.rex.RexBuilder.makeInputRef(RexBuilder.java:841)
>       at 
> org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewAggregateRule.rewriteView(AbstractMaterializedViewRule.java:1507)
>       at 
> org.apache.calcite.rel.rules.AbstractMaterializedViewRule.perform(AbstractMaterializedViewRule.java:522)
>       at 
> org.apache.calcite.rel.rules.AbstractMaterializedViewRule$MaterializedViewProjectAggregateRule.onMatch(AbstractMaterializedViewRule.java:1776)
>       at 
> org.apache.calcite.plan.volcano.VolcanoRuleCall.onMatch(VolcanoRuleCall.java:208)
>       ... 71 common frames omitted
> {code}
> Reproducible only if both Materialization views listed are enabled: any 
> single one of these two could be successfully used with the query without any 
> errors. 
> Currently, I'm trying to reproduce the issue in "MaterializationTest": 
> without a success so far, I'll update the ticket if I'll find a working way 
> to reproduce the issue in the test will be discovered.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to