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/12/06 02:59:37 UTC

[GitHub] [calcite] jinxing64 commented on a change in pull request #1619: [CALCITE-3537] Add NothingToCalcUnifyRule to match the top of MutableCalc in SubstitutionVisitor

jinxing64 commented on a change in pull request #1619: [CALCITE-3537] Add NothingToCalcUnifyRule to match the top of  MutableCalc in SubstitutionVisitor
URL: https://github.com/apache/calcite/pull/1619#discussion_r354645495
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
 ##########
 @@ -1070,6 +1071,70 @@ private ScanToCalcUnifyRule() {
     }
   }
 
+  /**
+   * A {@link SubstitutionVisitor.UnifyRule} that matches a {@link MutableCalc}
+   * which has {@link MutableAggregate} as  child.
+   * We try to compensate the {@link MutableCalc},
+   * then match the query to the top of {@link MutableCalc} in target.
+   */
+  private static class NothingToCalcUnifyRule extends AbstractUnifyRule {
+
+    public static final NothingToCalcUnifyRule INSTANCE =
+        new NothingToCalcUnifyRule();
+
+    private NothingToCalcUnifyRule() {
+      super(any(MutableRel.class),
+          any(MutableCalc.class), 0);
+    }
+
+    public UnifyResult apply(UnifyRuleCall call) {
+      final MutableRel rel = call.query;
+      final MutableCalc target = (MutableCalc) call.target;
+      final MutableRel targetInput = target.getInput();
+      final Pair<RexNode, List<RexNode>> qInputExplained = explainCalc(target);
+      if (rel.getParent() != null || target.getParent() != null) {
+        return null;
+      }
 
 Review comment:
   why this ?

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