[ 
https://issues.apache.org/jira/browse/CALCITE-4360?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17222730#comment-17222730
 ] 

Chunwei Lei commented on CALCITE-4360:
--------------------------------------

I am sorry that I misunderstood the codes. Currently, the substitution rule is 
already applied first though it is not so straightforward. The process looks 
like:

1.put the non-substitution rule at the front and substitution rule at the end 
of the queue

2.get each rule from the queue in order from first to last and generate an 
ApplyRule task

3.push the ApplyRule task into the stack

As you can see, the ApplyRule(substitution) task is poped earlier than the 
ApplyRule(non-substitution) task from the stack. Thus substitution rule is 
executed first.

> Apply SubstitutionRule first in top-down driven rule apply
> ----------------------------------------------------------
>
>                 Key: CALCITE-4360
>                 URL: https://issues.apache.org/jira/browse/CALCITE-4360
>             Project: Calcite
>          Issue Type: Improvement
>            Reporter: Chunwei Lei
>            Assignee: Chunwei Lei
>            Priority: Major
>              Labels: pull-request-available
>         Attachments: image-2020-10-27-21-55-55-155.png
>
>          Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> In the current implementation, TopDownRuleQueue adds substitute rules in the 
> end wrongly. The SubstitutionRule should be executed first.
> !image-2020-10-27-21-55-55-155.png!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to