示例#1
0
def test_lean_by_with_summary():
    assert lean_projection(by(t.x, total=t.y.sum()))._child.isidentical(t[["x", "y"]])

    tt = t[["x", "y"]]
    result = lean_projection(by(t.x, a=t.y.sum(), b=t.z.sum())[["x", "a"]])
    expected = Projection(By(Field(tt, "x"), summary(a=sum(Field(tt, "y")))), ("x", "a"))
    assert result.isidentical(expected)
示例#2
0
def test_lean_by_with_summary():
    assert lean_projection(by(t.x, total=t.y.sum()))._child.isidentical(
        t[['x', 'y']])

    tt = t[['x', 'y']]
    result = lean_projection(by(t.x, a=t.y.sum(), b=t.z.sum())[['x', 'a']])
    expected = Projection(By(Field(tt, 'x'), summary(a=sum(Field(tt, 'y')))),
                          ('x', 'a'))
    assert result.isidentical(expected)
示例#3
0
def test_lean_by_with_summary():
    assert lean_projection(by(t.x, total=t.y.sum()))._child.isidentical(
                    t[['x', 'y']])

    tt = t[['x', 'y']]
    result = lean_projection(by(t.x, a=t.y.sum(), b=t.z.sum())[['x', 'a']])
    expected = Projection(
                    By(Field(tt, 'x'), summary(a=sum(Field(tt, 'y')))),
                    ('x', 'a'))
    assert result.isidentical(expected)
示例#4
0
def test_merge():
    expr = lean_projection(merge(a=t.x + 1, y=t.y))
    assert expr._child.isidentical(t[['x', 'y']])
示例#5
0
def test_distinct():
    expr = t.distinct()[['x', 'y']]
    assert lean_projection(expr).isidentical(expr)
示例#6
0
def test_sort():
    assert lean_projection(t.sort('x').y).isidentical(t[['x','y']].sort('x').y)
示例#7
0
def test_lean_projection_by():
    assert lean_projection(by(t.x, t.y.sum()))._child.isidentical(
                    t[['x', 'y']])
示例#8
0
文件: bcolz.py 项目: vitan/blaze
def optimize(expr, _):
    return lean_projection(expr)
示例#9
0
def test_distinct():
    expr = t.distinct()[['x', 'y']]
    assert lean_projection(expr).isidentical(expr)
示例#10
0
def test_merge_with_table():
    expr = lean_projection(merge(t, a=t.x + 1))
    assert expr.isidentical(expr)  # wut?
示例#11
0
def test_merge():
    expr = lean_projection(merge(a=t.x + 1, y=t.y))
    assert expr._child.isidentical(t[["x", "y"]])
示例#12
0
def test_sort():
    assert lean_projection(t.sort("x").y).isidentical(t[["x", "y"]].sort("x").y)
示例#13
0
def test_lean_projection_by():
    assert lean_projection(by(t.x, total=t.y.sum()))._child.isidentical(t[["x", "y"]])
示例#14
0
def test_lean_projection():
    assert lean_projection(t[t.x > 0].y)._child._child.isidentical(t[["x", "y"]])
示例#15
0
def test_like():
    t = symbol('t', 'var * {name: string, x: int, y: int}')
    expr = t.like(name='Alice').y

    result = lean_projection(expr)
    assert result._child._child.isidentical(t[['name', 'y']])
示例#16
0
def test_merge_with_table():
    expr = lean_projection(merge(t, a=t.x + 1))
    assert expr.isidentical(expr)
示例#17
0
def test_elemwise_thats_also_a_column():
    t = symbol('t', 'var * {x: int, time: datetime, y: int}')
    expr = t[t.x > 0].time.truncate(months=1)
    expected = t[['time', 'x']]
    result = lean_projection(expr)
    assert result._child._child._child.isidentical(t[['time', 'x']])
示例#18
0
def test_head():
    assert lean_projection(t.sort("x").y.head(5)).isidentical(t[["x", "y"]].sort("x").y.head(5))
示例#19
0
def test_like():
    t = symbol('t', 'var * {name: string, x: int, y: int}')
    expr = t[t.name.like('Alice')].y

    result = lean_projection(expr)
    assert result._child._child.isidentical(t[['name', 'y']])
示例#20
0
def test_elemwise_thats_also_a_column():
    t = symbol("t", "var * {x: int, time: datetime, y: int}")
    expr = t[t.x > 0].time.truncate(months=1)
    expected = t[["time", "x"]]
    result = lean_projection(expr)
    assert result._child._child._child.isidentical(expected)
示例#21
0
def test_lean_projection():
    assert lean_projection(t[t.x > 0].y)._child._child.isidentical(t[['x', 'y']])
示例#22
0
def test_distinct():
    expr = t.distinct()[["x", "y"]]
    assert lean_projection(expr).isidentical(expr)
示例#23
0
def test_like():
    t = symbol("t", "var * {name: string, x: int, y: int}")
    expr = t[t.name.like("Alice")].y
    result = lean_projection(expr)
    assert result._child._child.isidentical(t[["name", "y"]])
示例#24
0
文件: bcolz.py 项目: vitan/blaze
def optimize(expr, _):
    return lean_projection(expr)
示例#25
0
def test_head():
    assert lean_projection(t.sort('x').y.head(5)).isidentical(
                t[['x','y']].sort('x').y.head(5))
示例#26
0
def test_elemwise_thats_also_a_column():
    t = symbol('t', 'var * {x: int, time: datetime, y: int}')
    expr = t[t.x > 0].time.truncate(months=1)
    expected = t[['time', 'x']]
    result = lean_projection(expr)
    assert result._child._child._child.isidentical(t[['time', 'x']])