

def test_complex_summaries():
    t = symbol('t', '100 * {a: int, b: int}')
    ((chunk, chunk_expr), (agg, agg_expr)) = split(t, summary(q=t.a.mean(), w=t.a.std(), e=t.a.sum()))
    assert chunk_expr.isidentical(summary(e=chunk.a.sum(), q_count=chunk.a.count(), q_total=chunk.a.sum(), w_n=chunk.a.count(), w_x=chunk.a.sum(), w_x2=(chunk.a ** 2).sum(), keepdims=True))
    expected = summary(e=agg.e.sum(), q=(agg.q_total.sum() / agg.q_count.sum()), w=sqrt(((agg.w_x2.sum() / agg.w_n.sum()) - ((agg.w_x.sum() / agg.w_n.sum()) ** 2))))
    assert agg_expr.isidentical(expected)

dataset/ETHPy150Open blaze/blaze/blaze/expr/tests/test_split.py test_complex_summaries/original