I encountered a similar situation recently and the issue was that some of the attributes used in the groupby clause were very large strings. Limiting the length of the characters in these attributes fixed the issue for me. For example I reduced the limit of character length from 2000 to 50.
... View more