[
https://issues.apache.org/jira/browse/CALCITE-3939?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17118941#comment-17118941
]
Botong Huang commented on CALCITE-3939:
---------------------------------------
Thanks [~anha] for reporting the issue. However, as [~hyuan] mentioned,
something is missing in your scenario.
Let's say the LogicalSort, TrivialProject, CustomScan are in RelSet 1, 2, 3
respectively. Here's what it should have happened.
# RuleX matches LogicalSort and TrivialProject (RuleX.matches called with
<LogicalSort, TrivialProject>). This RuleMatch1 gets queued in RuleQueue.
# ProjectRemoveRule fires, it marks TrivialProject as stale, triggers RelSet 2
and 3 to merge, say into RelSet 2. Now both TrivialProject and CustomScan are
in RelSet 2.
# The planner.fireRules in RelSet.mergeWith will trigger a new round of
RuleMatch for all relNodes in RelSet 2. Specifically RuleX should have a new
match with LogicalSort and CustomScan (RuleX.matches called with <LogicalSort,
CustomScan>). This RuleMatch2 is also queued in RuleQueue.
# RuleMatch1 pops from ruleQueue, and since TrivialProject is stale, this
match is skipped and onMatch not called.
# RuleMatch2 pops from ruleQueue, and RuleX.onMatch called with <LogicalSort,
CustomScan>.
Please let us know what went wrong here.
> Change UnionEliminatorRule and ProjectRemoveRule to auto pruning
> SubstitutionRule
> ---------------------------------------------------------------------------------
>
> Key: CALCITE-3939
> URL: https://issues.apache.org/jira/browse/CALCITE-3939
> Project: Calcite
> Issue Type: Improvement
> Reporter: Botong Huang
> Priority: Major
> Fix For: 1.23.0
>
> Time Spent: 50m
> Remaining Estimate: 0h
>
> UnionEliminatorRule and ProjectRemoveRule are both pruning rules for a
> RelNode. They can also become SubstitutionRule with autoprune enabled
--
This message was sent by Atlassian Jira
(v8.3.4#803005)