I need to traverse the parents of *JdbcTableScan*(s). But the
*RelOptRuleCall.getParents()* never returned anything but *NULL* to me. So
how can I get the parents of a matched node while a rule is being executed
? Also the *RelNode* interface doesn't seem to provide a similar method to
get the node's parents. And after getting the parents, how can I convert
one of the parents instead the matched node ?

If you find my question weird, please consider the following plan

JdbcSort
    *JdbcAggregate*
        JdbcProject
            JdbcJoin
                JdbcJoin
                    JdbcTableScan
                    JdbcTableScan
                *JdbcProject*
                    JdbcFilter
                        *JdbcAggregate*
                            JdbcProject
                                JdbcJoin
                                    JdbcTableScan
                                    JdbcTableScan

There are 2 *JdbcAggregate* nodes (in bold) in this plan. I need to write a
rule that can *convert* nodes with the following conditions:

   1. It's children cover as much nodes as possible of the plan.
   2. It's children includes only one *JdbcAggregate*.
   3. It's children does not include a BiRel.

This means that I need to *convert* the underlined *JdbcProject* node only.
To do that, I believe I need to traverse the parents of *JdbcTableScan*(s)
(i.e. the lowest possible node in a plan).

Reply via email to