Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CALCITE-4276] MaterializedViewOnlyAggregateRule performs invalid rew…
…rite on query that contains join and time-rollup function (FLOOR) (Justin Swett) Without the fix, MaterializedViewOnlyAggregateRule gets a field ordinal wrong, which manifests as a type mismatch something like this: java.lang.AssertionError: type mismatch: ref: TIMESTAMP(3) input: INTEGER NOT NULL at org.apache.calcite.util.Litmus$1.fail(Litmus.java:32) at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:2207) at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:129) It's difficult to see among all the refactoring, but the fix is just two lines; in MaterializedViewOnlyAggregateRule, change final int k = find(topViewProject, r); to final int j = find(viewNode, r); final int k = find(topViewProject, j); and the problem goes away.
- Loading branch information