Hi Aitozi,

The example you posted does not correspond to how the Spool operator is
implemented in Calcite.

The Calcite plan has a tree structure not a DAG structure.

Best,
Stamatis

On Mon, Mar 13, 2023 at 4:34 PM Aitozi <[email protected]> wrote:

> Hi Stamatis,
>     Thanks for your reply. As I understand, for the Spool operator it can
> has multiple
> consumer as its parents. For HepPlanner and CommonRelSubExprRule it will
> inject
> the parents into the HepRuleCall, So during the match/onMatch, we can see
> the whole structure
> of the Spool and its parents.
>
> for example, in this structure:
>
>  Sink          Sink
>     |               |
> Project      Project
>     \              /
>         Spool
>             |
>         Scan
>
> Then In this way, I can see all the parents of the Spool and push down the
> unified projects down to the Spool operator.
> I think it's a useful optimize rule for the common subExprs.
>
> Best,
> Aitozi.
>
> Stamatis Zampetakis <[email protected]> 于2023年3月13日周一 20:27写道:
>
> > Hi Aitozi,
> >
> > All Calcite's built-in operators (including Spool) have a single parent
> so
> > I don't fully understand what you mean by "parent components".
> >
> > What exactly do you expect to see in the rule match? Can you provide some
> > concrete examples?
> >
> > In order to get the parent of the spool operator I guess you would have
> to
> > create a rule with the following supplier:
> >
> > withOperandSupplier(b0 -> b0.operand(RelNode.class).oneInput(b1 ->
> > b1.operand(Spool.class).anyInputs()))
> >
> > Best,
> > Stamatis
> >
> > On Sun, Mar 12, 2023 at 5:07 PM Aitozi <[email protected]> wrote:
> >
> > > It seems for a specific rule: CommonRelSubExprRule, the HepPlanner will
> > > inject the parent nodes. I will try on this.
> > >
> > > Best,
> > > Aitozi
> > >
> > > Aitozi <[email protected]> 于2023年3月12日周日 09:26写道:
> > >
> > > > Hi
> > > >     Recently, I've been conducting research on how to maximize the
> > > > potential of Spool for CTE reuse optimization. My goal is to
> streamline
> > > the
> > > > push down process and filters across all consumer nodes. However, I
> > have
> > > > encountered a roadblock as the current rule pattern fails to
> accurately
> > > > describe the  structure of Spool and its parent components. So, in
> the
> > > rule
> > > > match we can not see the structure as a whole. Would greatly
> appreciate
> > > any
> > > > guidance or insights on this topic.
> > > >
> > > > Thanks,
> > > > Aitozi
> > > >
> > >
> >
>

Reply via email to