telepath / com.github.giedomak.telepath.datamodels.plans.utilities / MultiTreeContainment / containsSubtreesThroughOperator

containsSubtreesThroughOperator

fun containsSubtreesThroughOperator(root: LogicalPlan, s1: LogicalPlan, s2: LogicalPlan, operatorId: Int): Boolean (source)

Given a root LogicalPlan, check if s1 and s2 are contained as subtrees in root through the given operatorId.

Since we could be dealing with partial subtrees, we have to flatten again...

Given s1 & s2:

    CONCATENATION              CONCATENATION
       /    \                     /    \
      a      b                   c      d

Tree:

    CONCATENATION
      /  |  |  \
     a   b  c   d

containsSublistOfChildren(tree, s1, s2) should equal true.

Parameters

root - The root LogicalPlan we'll be using to check containment of given subtrees.

s1 - The first subtree.

s2 - The second subtree.

operatorId - The operator through which s1 and s2 are connected.

Return
True if s1 and s2 are connected through operatorId and contained in root.