implemented insert-by-query plan

I think we could create the projection as static or create a helper function to create the aggregation projection. It is also created in the copyToPlan