Example #1
0
def test_compute_multiple_client_datasets():
    a1 = resource('blaze://localhost:6363::accounts')
    a2 = resource('blaze://localhost:6363::accounts2')
    s1 = Symbol('s1', discover(a1))
    s2 = Symbol('s2', discover(a2))

    assert compute(s1.amount.sum() + s2.amount.sum(),
            {s1: a1, s2: a2}) == 600
Example #2
0
def test_expr_client():
    ec = ExprClient('localhost:5000', 'accounts_df')
    assert discover(ec) == discover(df)

    t = TableSymbol('t', discover(ec))
    expr = t.amount.sum()

    assert compute(expr, ec) == 300
    assert compute(t.name, ec) == ['Alice', 'Bob']
Example #3
0
def test_expr_client():
    ec = Client('localhost:6363', 'accounts')
    assert discover(ec) == discover(df)

    t = TableSymbol('t', discover(ec))
    expr = t.amount.sum()

    assert compute(expr, ec) == 300
    assert 'name' in t.fields
    assert isinstance(t.name, Field)
    assert compute(t.name, ec) == ['Alice', 'Bob']
Example #4
0
def test_client():
    c = Client('localhost:6363')
    assert str(discover(c)) == str(discover(server.datasets))

    t = Symbol('t', discover(c))
    expr = t.accounts.amount.sum()

    assert compute(expr, c) == 300
    assert 'name' in t.accounts.fields
    assert isinstance(t.accounts.name, Field)
    assert compute(t.accounts.name, c) == ['Alice', 'Bob']
Example #5
0
def test_custom_expressions():
    ec = Client('localhost:6363', 'accounts')
    t = TableSymbol('t', discover(ec))

    assert list(map(tuple, compute(CustomExpr(t), ec))) == into(list, df)
Example #6
0
def test_resource_all_in_one():
    ec = resource('blaze://localhost:6363::accounts')
    assert discover(ec) == discover(df)
Example #7
0
def test_resource_default_port():
    ec = resource('blaze://localhost', 'accounts')
    assert discover(ec) == discover(df)
Example #8
0
def test_resource():
    ec = resource('blaze://localhost:6363', 'accounts')
    assert discover(ec) == discover(df)
Example #9
0
def test_resource_default_port():
    ec = resource('blaze://localhost')
    assert str(discover(ec)) == str(discover(server.datasets))
Example #10
0
def test_resource_with_dataset():
    c = resource('blaze://localhost:6363::accounts')
    assert str(discover(c)) == str(discover(df))
Example #11
0
def test_resource():
    c = resource('blaze://localhost:6363')
    assert str(discover(c)) == str(discover(server.datasets))
Example #12
0
def test_compute_client_with_multiple_datasets():
    c = resource('blaze://localhost:6363')
    s = Symbol('s', discover(c))

    assert compute(s.accounts.amount.sum() + s.accounts2.amount.sum(),
                    {s: c}) == 600
Example #13
0
def test_compute_with_dataset():
    c = resource('blaze://localhost:6363::accounts')
    s = Symbol('s', discover(c))

    assert compute(s.name, c) == ['Alice', 'Bob']
Example #14
0
def test_resource_all_in_one():
    ec = resource('blaze://localhost:6363')
    assert str(discover(ec)) == str(discover(server.datasets))
Example #15
0
def test_resource():
    ec = resource('blaze://localhost:5000', 'accounts_df')
    assert discover(ec) == discover(df)