xy2953396112 commented on a change in pull request #2094:
URL: https://github.com/apache/calcite/pull/2094#discussion_r469787716



##########
File path: 
core/src/main/java/org/apache/calcite/plan/RelOptMaterializations.java
##########
@@ -60,7 +60,8 @@
    *         materialized views used in the transformation.
    */
   public static List<Pair<RelNode, List<RelOptMaterialization>>> 
useMaterializedViews(
-      final RelNode rel, List<RelOptMaterialization> materializations) {
+      final RelNode rel, List<RelOptMaterialization> materializations,
+      List<SubstitutionVisitor.UnifyRule> materializationRules) {
     final List<RelOptMaterialization> applicableMaterializations =
         getApplicableMaterializations(rel, materializations);

Review comment:
       Maybe we can be compatible with the original interface.In my project, 
this is how to register external materialized view matching rules.
   
   

##########
File path: 
core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
##########
@@ -279,6 +282,10 @@ public RelNode getRoot() {
     return ImmutableList.copyOf(materializations);
   }
 
+  @Override public void registerMaterializationRules(List<UnifyRule> rules) {
+    materializationRules = ImmutableList.copyOf(rules);
+  }
+

Review comment:
       ok,make sense.

##########
File path: core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
##########
@@ -1741,7 +1741,7 @@ private static int fieldCnt(MutableRel rel) {
   }
 
   /** Explain filtering condition and projections from MutableCalc. */
-  private static Pair<RexNode, List<RexNode>> explainCalc(MutableCalc calc) {
+  public static Pair<RexNode, List<RexNode>> explainCalc(MutableCalc calc) {
     final RexShuttle shuttle = getExpandShuttle(calc.program);
     final RexNode condition = shuttle.apply(calc.program.getCondition());

Review comment:
       This modifier is used in 
`org.apache.calcite.test.MaterializationTest.CustomizedMaterializationRule`.
   If external rules need to use this method, we should change it.
   




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


Reply via email to