This is a lot of extra code just to disable the agg pushdown -- the pushdown code already knows how to handle that case. Just set topAggNode to null instead of initializing it at the top of this function and let the original code do its job.