Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

In AsterixDB's logical query plan, we use a SubplanOperator which contains nested logical plans to represent subqueries. The rule InlineSubplanInputForNestedTupleSourceRule is to remove SubplanOperators containing DataScan, InnerJoin, LeftOuterJoin, UnionAll or Distinct. Given a qualified Subplan operator called S1, Let's call its input operator O1.

 

General Cases

 We We have the following rewritings for general cases:

 R1R1. Replace all NestedTupleSourceOperators in S1 with deep-copies (with new variables) of the query plan rooted at O1;

 R2R2. Add a LeftOuterOperatorJoinOperator (let's call it LJ) between O1 and the SubplanOperator's       root s root operator's input (let's call it SO1), where O1 is the left branch and SO1 is the right       branchright branch;

R3. The deep copy of the primary key variables in O1 should be preserved from an inlined       inlined NestedTupleSourceOperator to SO1. The join condition of LJ is the equality between       the between the primary key variables in O1 and its deep copied version at SO1;

...

R5. On top of the LJ, add a GroupByOperaptor in which the nested plan consists of the       S1the S1's root operator, i.e., an aggregate operator. Below the aggregate, there is a not-null-filter       on filter on variable v. The group key is the primary key variables in O1.

...

            empty-tuple-source -- |UNPARTITIONED|

 

 After plan:

distribute result [%0->$$13] -- |UNPARTITIONED|

...