Compile constants in group by and order by to perform validation