Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.19.0
Description
Add test case in MaterializationTest:
@Test public void testAggregateAlias() { checkMaterialize( "select count(*) as c from \"emps\" group by \"empid\"", "select count(*) + 1 as c from \"emps\" group by \"empid\""); }
It fails due to different rowtype.
java.lang.AssertionError at org.apache.calcite.plan.SubstitutionVisitor.go(SubstitutionVisitor.java:504) at org.apache.calcite.plan.SubstitutionVisitor.go(SubstitutionVisitor.java:465) at org.apache.calcite.plan.MaterializedViewSubstitutionVisitor.go(MaterializedViewSubstitutionVisitor.java:56) at org.apache.calcite.plan.RelOptMaterializations.substitute(RelOptMaterializations.java:200) at org.apache.calcite.plan.RelOptMaterializations.useMaterializedViews(RelOptMaterializations.java:72) at org.apache.calcite.plan.volcano.VolcanoPlanner.registerMaterializations(VolcanoPlanner.java:347)
However, according to MutableAggregate's hashCode&equals implementation, this materialization can be reused, i.e., queryDescedant=targetDescendant.
queryDescendant: RecordType(JavaType(int) empid, BIGINT $f1) ============================================================================= Aggregate(groupSet: {0}, groupSets: [{0}], calls: [COUNT()]) Project(projects: [$0]) Scan(table: [hr, emps]) targetDescendant: RecordType(JavaType(int) empid, BIGINT C) ============================================================================= Aggregate(groupSet: {0}, groupSets: [{0}], calls: [COUNT()]) Project(projects: [$0]) Scan(table: [hr, emps])
So, how can we align them?
Attachments
Issue Links
- is related to
-
CALCITE-3469 Wrong rel used in SubstitutionVisitor#rowTypesAreEquivalent
- Closed
- relates to
-
CALCITE-3182 Trim unused fields for plan of materialized-view before matching.
- Closed
- links to