commit | 0fb14d553764f2a993ec56db4a36de2713ac1206 | [log] [tgz] |
---|---|---|
author | Justin Swett <jswett@google.com> | Tue Sep 29 21:48:42 2020 -0700 |
committer | Julian Hyde <jhyde@apache.org> | Wed Mar 03 17:50:06 2021 -0800 |
tree | 29f20a3246c4e3b2aa4365e38981d9205fc40861 | |
parent | 00d1086c7003115a9ed9dcc874051f515b7b5aae [diff] |
[CALCITE-4276] MaterializedViewOnlyAggregateRule performs invalid rewrite 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.
Apache Calcite is a dynamic data management framework.
It contains many of the pieces that comprise a typical database management system but omits the storage primitives. It provides an industry standard SQL parser and validator, a customisable optimizer with pluggable rules and cost functions, logical and physical algebraic operators, various transformation algorithms from SQL to algebra (and the opposite), and many adapters for executing SQL queries over Cassandra, Druid, Elasticsearch, MongoDB, Kafka, and others, with minimal configuration.
For more details, see the home page.