mvScanNode is not needed -- if you call replaceScanNodeWithReAggNode on the SEND node instead of the send node's child, you can apply that function in both the join and single table case (before testing for a join) and you can apply addInlinePlanNode to the scan node when you find it in that function.