@dispatch(Summary)
def _split_agg(expr, leaf=None, chunk=None, agg=None, keepdims=True):
    exprs = [(name, split(leaf, val, keepdims=False)[1])
                for name, val in zip(expr.fields, expr.values)]

    d = dict()
    for name, (a, ae) in exprs:
        if isscalar(a.dshape.measure): # For simple reductions
            d[name] = ae._subs({a: agg[name]})
        elif isrecord(a.dshape.measure):  # For reductions like mean/var
            names = ['%s_%s' % (name, field) for field in a.fields]
            namedict = dict(zip(a.fields, names))
            d[name] = ae._subs(toolz.merge({a: agg}, namedict))

    return summary(**d)
dataset/ETHPy150Open blaze/blaze/blaze/expr/split.py/_split_agg/original