If the root is the only place it can match you could almost apply the rule 
manually (well, you’d have to write your own implementation of RelOptRuleCall).

You could customize HepPlanner so that it doesn’t look below the root node.

Or, you could invent a new RelNode type (a concrete sub-class of SingleRel 
would probably do the trick) called Marker and place it at the root node. Make 
your match only if a Marker is on top. Since no other rules match Marker it 
would remain at the root.

Julian


> On Jan 31, 2017, at 7:32 AM, Renaud Delbru <renaud@siren.solutions> wrote:
> 
> Hi,
> 
> In our scenario, we can have a relational expression that is composed of a
> single logical table function scan operator (i.e., the logical table
> function scan operator if the root of the relational expression). We would
> like to be able to differentiate this with scenarios where this operator
> appears as a leaf of some other operators. However, I am not able to find a
> way to properly express this as a rule, e.g., by restricting a rule to
> match only from the root of the relational expression. Or is there another
> way to achieve this ?
> 
> Thanks,
> Regards
> 
> -- 
> Renaud Delbru

Reply via email to