def __init__(self, table, metrics, by=None, having=None, predicates=None, sort_keys=None):
    metrics = self._rewrite_exprs(table, metrics)
    by = ([] if (by is None) else by)
    by = table._resolve(by)
    having = ([] if (having is None) else having)
    predicates = ([] if (predicates is None) else predicates)
    sort_keys = ([] if ((not by) or (sort_keys is None)) else sort_keys)
    sort_keys = [to_sort_key(table, k) for k in util.promote_list(sort_keys)]
    by = self._rewrite_exprs(table, by)
    having = self._rewrite_exprs(table, having)
    predicates = self._rewrite_exprs(table, predicates)
    sort_keys = self._rewrite_exprs(table, sort_keys)
    super().__init__(table=table, metrics=metrics, by=by, having=having, predicates=predicates, sort_keys=sort_keys)
def __init__(self, table, metrics, by=None, having=None, predicates=None, sort_keys=None):
    metrics = self._rewrite_exprs(table, metrics)
    by = ([] if (by is None) else by)
    by = table._resolve(by)
    having = ([] if (having is None) else having)
    predicates = ([] if (predicates is None) else predicates)
    sort_keys = ([] if ((not by) or (sort_keys is None)) else sort_keys)
    sort_keys = [to_sort_key(table, k) for k in util.promote_list(sort_keys)]
    by = self._rewrite_exprs(table, by)
    having = self._rewrite_exprs(table, having)
    predicates = self._rewrite_exprs(table, predicates)
    sort_keys = self._rewrite_exprs(table, sort_keys)
    super().__init__(table=table, metrics=metrics, by=by, having=having, predicates=predicates, sort_keys=sort_keys)