[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Apply a rule to the same node only once

I'm not sure but I believe you have to leave the matched node in a new
shape that doesn't make the rule match again. Like at least collect the
node's information and put them into a new node, convert the matched node
to the new node and have a boolean flag in the newly created node marked as
true. And then let the rule matches look for that flag, if it's there and
it's true, then don't run the rule.

Having that said, converting the node into a new one, with a new type. The
rule matcher can check if the node is of that type, and if it is, then the
rule was applied once before. So you don't need to run it again.

Hopefully that helps.


On Tue, Nov 27, 2018 at 5:06 AM Hequn Cheng <chenghequn@xxxxxxxxx> wrote:

> Hi,
> Does Calcite provide a way to apply a rule for the same node only once with
> HepPlanner?
> I find that we can use `addMatchLimit()` to limit times for the whole plan,
> but it seems there is no way to limit times for a RelNode, similar to a
> ConvertRule.
> Any help would be appreciated!
> Best,
> Hequn