Hi, Aitozi. I think you can check RelRule#unorderedInputs[1]. One of its uses is PruneEmptyRules.
[1] https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/plan/RelRule.java#L219 Best, Chunwei On Tue, Jan 10, 2023 at 12:32 AM Ruben Q L <[email protected]> wrote: > Hello Aitozi, > > Could you please provide one or several examples of a plan that your rule > aims to match? (as it was done in > https://issues.apache.org/jira/browse/CALCITE-3761) > Maybe you could use RelRule#OperandDetailBuilder#predicate [1] and write > your (more-or-less-complex) predicate function for the rule operand(s)? > > Best, > Ruben > > [1] > > https://github.com/apache/calcite/blob/main/core/src/main/java/org/apache/calcite/plan/RelRule.java#L210 > > > > On Mon, Jan 9, 2023 at 12:40 PM Aitozi <[email protected]> wrote: > > > Hi, community: > > When I write a rule to match a subtree as a union followed by any > > number of RelNodes which is not an exchange node (I think this subtree > > can transpose before the union nodes), It will help reduce the shuffle > > in physical nodes. But there seems to be no suitable API to describe > > this greedy pattern match with an arbitrary number of intermediate > > nodes. If there is sth I missed, I would appreciate it if anyone could > > help point it out. > > > > BTW, I read this ticket, it seems to have similar requirements: > > > > https://issues.apache.org/jira/browse/CALCITE-3761 > > > > Thanks > > Aitozi. > > >
