@_lambda_eval
def map(self, *entities: Union[(Entity, str)], **kwargs):
    from olo.model import ModelMeta
    self._raw = kwargs.get('raw', False)
    entities = self._get_entities(entities)
    q = self._update(_entities=list(chain.from_iterable(((x if isinstance(x, (list, tuple, set)) else (x,)) for x in entities))))
    has_aggregation = False
    first_field = None
    for entity in q._entities:
        if (isinstance(entity, ModelMeta) and (first_field is None)):
            first_field = self._model_class.get_singleness_pk_field()
        if (isinstance(entity, Field) and (first_field is None)):
            first_field = entity
        if isinstance(entity, Function):
            has_aggregation = True
    if (has_aggregation and (first_field is not None)):
        q = q.group_by(first_field)
    return q
@_lambda_eval
def map(self, *entities: Union[(Entity, str)], **kwargs):
    from olo.model import ModelMeta
    self._raw = kwargs.get('raw', False)
    entities = self._get_entities(entities)
    q = self._update(_entities=list(chain.from_iterable(((x if isinstance(x, (list, tuple, set)) else (x,)) for x in entities))))
    has_aggregation = False
    first_field = None
    for entity in q._entities:
        if (isinstance(entity, ModelMeta) and (first_field is None)):
            first_field = self._model_class.get_singleness_pk_field()
        if (isinstance(entity, Field) and (first_field is None)):
            first_field = entity
        if isinstance(entity, Function):
            has_aggregation = True
    if (has_aggregation and (first_field is not None)):
        q = q.group_by(first_field)
    return q