def set_group_by(self):
        self.group_by = []

        for col, _ in self.select:
            self.group_by.append(col)
Expands the GROUP BY clause required by the query.
dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/Django-1.6.10/django/db/models/sql/query.py/Query.set_group_by