...
This is an abstract example for the rewriting mechanism described above:
Before rewriting:
--Op1
--Subplan{
--AggregateOp
--NestedOp
.....
--Nested-Tuple-Source
}
--InputOp
.....
After rewriting:
--Op1
--GroupBy v_lc_1, ..., v_lc_n Decor v_l1, ....v_ln {
--AggregateOp
--Select v_new!=NULL
-- Nested-Tuple-Source
}
--LeftOuterJoin (v_lc_1=v_rc_1 AND .... AND v_lc_n=v_rc_n)
(left branch)
--InputOp
.....
(right branch)
-- Assign v_new=TRUE
--NestedOp
.....
--Deepcopy_The_Plan_Rooted_At_InputOp_With_New_Variables(InputOp)
In the plan, v_lc_1, ..., v_lc_n are live "covering" variables at InputOp,while while v_rc_1, ..., v_rc_n are their corresponding variables populated from the deepcopy of InputOp.( "Covering" variables form a set of variables that can imply all live variables.)v v_l1, ....v_ln in the decoration part of the added group-by operator are alllive all live variables at InputOp except the covering variables v_lc_1, ..., v_lc_n. In the current implementation, we use "covering" variables as primary key variables. In the next version, we will use the real primary key variables.
Here is a concrete example of the general case rewriting (optimizerts/queries/nested_loj4.aql).
...