You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "Xurenhe (Jira)" <ji...@apache.org> on 2021/09/25 13:10:00 UTC
[jira] [Created] (CALCITE-4801) SubstitutionVisitor don't support
query pull up no-equal filter, when mv's aggregate rollup to query's
aggregate
Xurenhe created CALCITE-4801:
--------------------------------
Summary: SubstitutionVisitor don't support query pull up no-equal filter, when mv's aggregate rollup to query's aggregate
Key: CALCITE-4801
URL: https://issues.apache.org/jira/browse/CALCITE-4801
Project: Calcite
Issue Type: Bug
Components: core
Reporter: Xurenhe
Assignee: Xurenhe
SubstitutionVisitor don't support pull up filter under query's aggregate, for example:
{code:java}
// test case
@Test void testNoEqualFilterInAgg() {
final String mv = ""
+ "select \"name\", \"deptno\", count(distinct \"commission\") as cnt\n"
+ "from \"emps\"\n"
+ " group by \"name\", \"deptno\"";
final String query = ""
+ "select \"deptno\", count(distinct \"commission\") as cnt\n"
+ "from \"emps\" where \"name\" <> 'jack'\n"
+ "group by \"deptno\"";
sql(mv, query).ok();
}{code}
{code:java}
// exec mv match fail
+Materialized view failed to be matched by optimized results:+java.lang.AssertionError: Materialized view failed to be matched by optimized results:+ at org.apache.calcite.test.AbstractMaterializedViewTest.checkMaterialize(AbstractMaterializedViewTest.java:116) + at org.apache.calcite.test.AbstractMaterializedViewTest.access$000(AbstractMaterializedViewTest.java:67) + at org.apache.calcite.test.AbstractMaterializedViewTest$Sql.ok(AbstractMaterializedViewTest.java:229) + at java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:627) + at org.apache.calcite.util.ImmutableBeans.lambda$makeDef$3(ImmutableBeans.java:299) + at org.apache.calcite.util.ImmutableBeans$BeanImpl.invoke(ImmutableBeans.java:480) + at com.sun.proxy.$Proxy16.ok(Unknown Source) + at org.apache.calcite.test.MaterializedViewSubstitutionVisitorTest.testNoEqualFilterInAgg(MaterializedViewSubstitutionVisitorTest.java:1058) + at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
{code}
----
{code:java}
--query
select deptno, count(distinct commission) as cnt
from emps
where name <> 'jack'
group by deptno
-- mv
select name, deptno, count(distinct commission) as cnt
from emps
group by name, deptno
-- after executing mv-match
select deptno, cnt
from mv
where name <> 'jack'{code}
--
This message was sent by Atlassian Jira
(v8.3.4#803005)