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 2020/03/16 20:00:25 UTC

[GitHub] [calcite] jcamachor commented on a change in pull request #1858: [CALCITE-3862] Rewriting for materialized view consisting of group by on join keys with aggregate fails (Vineet Garg)

jcamachor commented on a change in pull request #1858: [CALCITE-3862] Rewriting for materialized view consisting of group by on join keys with aggregate fails (Vineet Garg)
URL: https://github.com/apache/calcite/pull/1858#discussion_r393277299
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewAggregateRule.java
 ##########
 @@ -673,15 +673,22 @@ protected MaterializedViewAggregateRule(RelOptRuleOperand operand,
       rewritingMapping = rewritingMappingB.build();
       final ImmutableMultimap<Integer, Integer> inverseMapping = rewritingMapping.inverse();
       final List<RexNode> projects = new ArrayList<>();
+
+      final ImmutableBitSet.Builder addedProjects = ImmutableBitSet.builder();
       for (int i = 0; i < queryAggregate.getGroupCount(); i++) {
+        int pos = groupSet.indexOf(inverseMapping.get(i).iterator().next());
+        addedProjects.set(pos);
         projects.add(
             rexBuilder.makeInputRef(result,
                 groupSet.indexOf(inverseMapping.get(i).iterator().next())));
       }
+
+      ImmutableBitSet projs = addedProjects.build();
 
 Review comment:
   `projs` -> `projectedColumns` ?

----------------------------------------------------------------
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