Aggregations parsing is too lenient.

Our parser currently accepts invalid aggregations definitions, this might trigger unexpected results like #5827.

Close #5827