jcamachor commented on a change in pull request #1212: [CALCITE-3052] Error 
while applying rule MaterializedViewAggregateRul…
URL: https://github.com/apache/calcite/pull/1212#discussion_r284100203
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/rules/AbstractMaterializedViewRule.java
 ##########
 @@ -1502,9 +1502,10 @@ protected 
MaterializedViewAggregateRule(RelOptRuleOperand operand,
               rexBuilder.makeInputRef(result,
                   groupSet.indexOf(inverseMapping.getTarget(i))));
         }
-        for (int i = 0; i < queryAggregate.getAggCallList().size(); i++) {
+        // We add aggregate functions that are present in result to projection 
list
+        for (int i = queryAggregate.getGroupCount(); i < 
result.getRowType().getFieldCount(); i++) {
           projects.add(
-              rexBuilder.makeInputRef(result, queryAggregate.getGroupCount() + 
i));
+              rexBuilder.makeInputRef(result, i));
         }
         result = relBuilder
 
 Review comment:
   Thanks for the comment @chunweilei . We have not been able to reproduce this 
issue with a test case, please see JIRA for more background.

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to