public class FromSubqueryColRefFactory extends java.lang.Object
|Constructor and Description|
|Modifier and Type||Method and Description|
We have a recently created FromSubquery node and we want to create a new ColumnReference to it.
Modify one side of the given predicate to contain the new FromSubquery ColumnReference.
public static ColumnReference build(int outerSelectNestingLevel, FromSubquery newFromSubquery, int fromSubqueryColumnToRef, NodeFactory nodeFactory, ContextManager contextManager) throws StandardException
select A.* from A join (select 1,b1,sum(b2) from B where b2 > x) foo where a1 > 1;Here we are creating a column reference that can be used in the outer query to reference foo.b1 so that we can add predicates to the outer query such as a1 = foo.b1
outerSelectNestingLevel- select node of the outer query.
newFromSubquery- the FromSubquery we are creating as part of subquery flattening.
fromSubqueryColumnToRef- 0-based index of the FromSubquery column we want to reference.
public static void replace(BinaryRelationalOperatorNode pred, ColumnReference colRef, int subquerySourceLevel)
select * form A where exists(select 1 from B where a1 = b1);
pred- In this BRON
colRef- Substitute this colRef
subquerySourceLevel- for the existing colRef at this source level.