Fix small subtle bug in GROUP_BY constraint.

@guenter @krishnap

Commit message should be sufficiently descriptive.
This will throw an exception when `_._1` is `None`. Please use `orderedByCount.headOption.flatMap(_._1).getOrElse("")` instead.