xy2953396112 commented on a change in pull request #2277:
URL: https://github.com/apache/calcite/pull/2277#discussion_r528460837
##########
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 {
+ List<? extends RexNode> rexNodes =
+ cluster.getRexBuilder().identityProjects(mutableQuery.rowType);
+ RexProgram program = RexProgram.create(
Review comment:
There is a `PR`[1] to enhance the normalization ability before the
recognition of materialized views by defining normalization rules. In the unit
test, the ability of materialized recognition is enhanced by compensating the
`Calc` operator. Through this way to achieve better versatility.
[1] [Add an interface in RelOptMaterializations to allow registering
normalization rules](https://github.com/apache/calcite/pull/2262/files)
----------------------------------------------------------------
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]