Make pattern matching work with group_by.
Adds tests for without.
Adds tests for pattern matching group_by.
Adds tests for has_fields and with_fields.