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/11/23 03:40:03 UTC

[GitHub] [calcite] xy2953396112 commented on a change in pull request #2277: [CALCITE-4376] Materialized view recognition fails when target project different columns with GROUP BY

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



##########
File path: core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
##########
@@ -192,8 +193,18 @@ public SubstitutionVisitor(RelNode target_, RelNode query_,
     this.simplify =
         new RexSimplify(cluster.getRexBuilder(), predicates, executor);
     this.rules = rules;
-    this.query = Holder.of(MutableRels.toMutable(query_));
+    MutableRel mutableQuery = MutableRels.toMutable(query_);
     this.target = MutableRels.toMutable(target_);
+    if (mutableQuery instanceof MutableCalc) {
+      this.query = Holder.of(mutableQuery);
+    } else {

Review comment:
       Here, we always try to compensate Calc in the original RelNode. Why can't we do it through custom normalization, or there will be more patterns in the future materialized view recognition. There should be a unified way to implement it.
   How do you think?




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