You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/07/20 09:35:55 UTC

[GitHub] [calcite] jinxing64 opened a new pull request #1324: wip

jinxing64 opened a new pull request #1324: wip
URL: https://github.com/apache/calcite/pull/1324
 
 
   In current code, `SubstitutionVisitor` & `MaterializedViewSubstitutionVisitor` fail to support below matching:
   ```
      query:   Project(projects: [$0, *(2, $1)])
                     Aggregate(groupSet: {0}, groupSets: [{0}], calls: [SUM($1)])
                        Scan(table: [hr, emps])</li>
      target:  Project(projects: [$0, *(2, $1), *(2, $2)])
                     Aggregate(groupSet: {0}, groupSets: [{0}], calls: [SUM($1), COUNT()])
                        Scan(table: [hr, emps])</li>
   ```
   
   And below test fails
   ```
   // MaterializationTest.java
     @Test public void testAggregate() {
       checkMaterialize(
         "select \"deptno\", count(1), 2 * sum(\"empid\") from "
           + "(select * from \"emps\" union all select * from \"emps\")"
           + "group by \"deptno\"",
         "select \"deptno\", 2 * sum(\"empid\") from "
           + "(select * from \"emps\" union all select * from \"emps\")"
           + "group by \"deptno\"");
     }
   ```
   
   The reason is that `Project&Aggregate` are not taken into consideration at the same time in current matching rules.
   It might make sense to create a rule of `ProjectOnAggregateToProjectOnAggregateUnifyRule` to handle such case.
   

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services