jinxing64 commented on a change in pull request #1451: [CALCITE-3334]
Refinement for Substitution-Based MV Matching
URL: https://github.com/apache/calcite/pull/1451#discussion_r324991111
##########
File path: core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
##########
@@ -916,18 +947,22 @@ public RexSimplify getSimplify() {
* Result of an application of a {@link UnifyRule} indicating that the
* rule successfully matched {@code query} against {@code target} and
* generated a {@code result} that is equivalent to {@code query} and
- * contains {@code target}.
+ * contains {@code target}. {@code triedEnough} indicates whether there's
Review comment:
As you can see -- In most cases, `triedEnough` is set to be `true`, the
behavior is consistent with the original logic, i.e. once a node of query
matches up with a result, it will not be matched again in following matching
iterations
(https://github.com/apache/calcite/blob/master/core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java#L515)
But in this PR, once a compensating `Calc` is generated, it will detect and
try to merge with its parent `Calc`
(https://github.com/apache/calcite/pull/1451/files#diff-442f8877d20c28297626599e9fa2a13dR1830).
In this case, the parent `Calc` should have the chance to be matched again
with nodes from `target` and `triedEnough` is set to be
`false`(https://github.com/apache/calcite/pull/1451/files#diff-442f8877d20c28297626599e9fa2a13dR1834)
----------------------------------------------------------------
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]
With regards,
Apache Git Services