...
c. there is no tuple dropping from the N1 to the J1
Rewriting R2 is not necessary since before J1, all tuples from N1 are preserved. But rewriting R1' to R4' But the following rewritings are needed:
R1'. Replace N1 by the O1 (no additional deep copy);
R2'. All inner joins on the path from N1 to J1 (including J1) are rewritten to a become left-outer join joins with the same join conditionconditions;
R3'. If N1 resides in the right branch of a an inner join (let's call it J2) in the path from N1 to J1, switch the left and right branches of J2;
R4'. For every left join from N1 to J1 transformed from an inner join, a variable vi indicating non-match tuples is assigned to TRUE in its right branch;
R4'. On top of J1, a GroupByOperaptor G1 is added where the group-by key is the primary key of O1 and the nested query plan for aggregation is the nested pipeline on top of J1 ( with a an added not-null-filter added)filter to check all vi are not null.
R5'. All other NestedTupleSourceOperators in the subplan is inlined with the query plan rooted at O1.
...