[
https://issues.apache.org/jira/browse/CALCITE-3060?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]
Haisheng Yuan resolved CALCITE-3060.
------------------------------------
Resolution: Fixed
Fix Version/s: 1.21.0
fixed in
https://github.com/apache/calcite/commit/bd42d29123c54200b6c3c213d8dbd8e8ec24db79,
thanks for the PR!
> Materialized view: "target out of range" error
> ----------------------------------------------
>
> Key: CALCITE-3060
> URL: https://issues.apache.org/jira/browse/CALCITE-3060
> Project: Calcite
> Issue Type: Bug
> Affects Versions: 1.19.0
> Reporter: Anton Haidai
> Assignee: Feng Zhu
> Priority: Major
> Labels: pull-request-available
> Fix For: 1.21.0
>
> Time Spent: 20m
> Remaining Estimate: 0h
>
> "MaterializationTest":
> {code}
> @Test public void testPermutationError() {
> CalciteAssert.that()
> .withMaterializations(
> HR_FKUK_MODEL,
> "m0",
> "select min(\"salary\"), count(*), max(\"salary\"),
> sum(\"salary\"), \"empid\" from \"emps\" group by \"empid\"",
> "m1",
> "select min(\"salary\"), count(*), max(\"salary\"),
> sum(\"salary\"), \"deptno\", \"empid\" from \"emps\" group by \"empid\",
> \"deptno\""
> )
> .query(
> "select count(*), \"empid\" from \"emps\" group by \"empid\"")
> .enableMaterializations(true)
> .explainContains("EnumerableTableScan(table=[[hr, m0]])")
> .sameResultWithMaterializationsDisabled();
> }
> {code}
> Error (looks like the mapping is expected to be bijection but it is not):
> {code}
> Caused by: java.lang.IllegalArgumentException: target out of range
> at org.apache.calcite.util.Permutation.<init>(Permutation.java:69)
> at org.apache.calcite.util.mapping.Mappings.bijection(Mappings.java:394)
> at
> org.apache.calcite.rel.mutable.MutableRels.createProject(MutableRels.java:142)
> at
> org.apache.calcite.plan.SubstitutionVisitor.unifyAggregates(SubstitutionVisitor.java:1269)
> at
> org.apache.calcite.plan.SubstitutionVisitor$AggregateOnProjectToAggregateUnifyRule.apply(SubstitutionVisitor.java:1345)
> at
> org.apache.calcite.plan.SubstitutionVisitor.go(SubstitutionVisitor.java:531)
> at
> org.apache.calcite.plan.SubstitutionVisitor.go(SubstitutionVisitor.java:466)
> {code}
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)