jcamachor commented on a change in pull request #1852: [CALCITE-3848] 
Materialized view rewriting fails for mv consisting of group by on join keys 
(Vineet Garg)
URL: https://github.com/apache/calcite/pull/1852#discussion_r390027440
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/rel/rules/materialize/MaterializedViewRule.java
 ##########
 @@ -1187,7 +1187,7 @@ protected RexNode shuttleReferences(final RexBuilder 
rexBuilder,
               }
               int pos = c.iterator().next();
               if (rewritingMapping != null) {
-                pos = rewritingMapping.getTargetOpt(pos);
+                pos = rewritingMapping.get(pos).iterator().next();
                 if (pos == -1) {
 
 Review comment:
   This could be `-1` when we called `getTargetOpt`. However, can this be `-1` 
now? Should we check for empty instead of `== -1`? Same for follow-up calls.

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to