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/08/13 07:21:00 UTC

[jira] [Created] (CALCITE-4735) Unify Rules in SubstitutionVisitor should be adjusted.

Xurenhe created CALCITE-4735:
--------------------------------

             Summary: Unify Rules in SubstitutionVisitor should be adjusted.
                 Key: CALCITE-4735
                 URL: https://issues.apache.org/jira/browse/CALCITE-4735
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Xurenhe


I think that executing query-rewriting by mv, sub of `UnifyRule` should be check which query's rel whether is rewrited by target's rel, which is matched in UnifyRule.
Let me give you an example of the current failure.

{code:java}
  @Test void testAggCallArgExpressedByMvProjs() {
    final String mv = ""
        + "select \"deptno\", \"name\""
        + "from \"emps\" group by \"deptno\", \"name\"";
    final String query = ""
        + "select \"deptno\", \"name\", count(distinct \"name\")"
        + "from \"emps\" group by \"deptno\", \"name\"";
    sql(mv, query).ok();
  }
{code}

In AggregateToAggregateUnifyRule, when executing `unifyAggregates`, we could find agg-calls of query could be expressed by agg-groups of target, we could add some new agg-calls to fill target's agg-calls.

Please review this viewpoint, if this viewpoint is right, I can do it.
Thanks a lot.




--
This message was sent by Atlassian Jira
(v8.3.4#803005)