Is it somehow important that the original scanColumns get added to the NodeSchema first, before the new group by columns?
If not, it would be simpler to add all the columns to the NodeSchema at the same time AFTER all the group by columns get added to mvNewScanColumns, instead of in two places.