예제 #1
0
def test_asof_join_with_tolerance(ibis_interval, timedelta_interval):
    left = ibis.table([('time', 'int32'), ('key', 'int32'),
                       ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('key', 'int32'),
                        ('value2', 'double')])

    joined = api.asof_join(left, right, 'time', tolerance=ibis_interval)
    tolerance = joined.op().tolerance
    assert_equal(tolerance, ibis_interval)

    joined = api.asof_join(left, right, 'time', tolerance=timedelta_interval)
    tolerance = joined.op().tolerance
    assert isinstance(tolerance, ir.IntervalScalar)
    assert isinstance(tolerance.op(), ops.Literal)
예제 #2
0
def test_pickle_asof_join():
    left = ibis.table([('time', 'int32'), ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('value2', 'double')])
    joined = api.asof_join(left, right, 'time')
    node = joined.op()

    assert_pickle_roundtrip(node)
예제 #3
0
파일: test_table.py 프로젝트: sanjc/ibis
def test_asof_join_with_by():
    left = ibis.table(
        [('time', 'int32'), ('key', 'int32'), ('value', 'double')])
    right = ibis.table(
        [('time', 'int32'), ('key', 'int32'), ('value2', 'double')])
    joined = api.asof_join(left, right, 'time', by='key')
    by = joined.op().by[0].op()
    assert by.left.op().name == by.right.op().name == 'key'
예제 #4
0
def test_asof_join():
    left = ibis.table([('time', 'int32'), ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('value2', 'double')])
    right = right.mutate(foo=1)

    joined = api.asof_join(left, right, 'time')
    result = joined[left, right.foo]
    graph = viz.to_graph(result)
    assert key(result) in graph.source
예제 #5
0
def test_asof_join():
    left = ibis.table([('time', 'int32'), ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('value2', 'double')])
    right = right.mutate(foo=1)

    joined = api.asof_join(left, right, 'time')
    result = joined[left, right.foo]
    graph = viz.to_graph(result)
    assert key(result) in graph.source
예제 #6
0
파일: test_table.py 프로젝트: cloudera/ibis
def test_asof_join_with_by():
    left = ibis.table(
        [('time', 'int32'), ('key', 'int32'), ('value', 'double')]
    )
    right = ibis.table(
        [('time', 'int32'), ('key', 'int32'), ('value2', 'double')]
    )
    joined = api.asof_join(left, right, 'time', by='key')
    by = joined.op().by[0].op()
    assert by.left.op().name == by.right.op().name == 'key'
예제 #7
0
def test_asof_join():
    left = ibis.table([('time', 'int32'), ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('value2', 'double')])
    joined = api.asof_join(left, right, 'time')

    assert joined.columns == [
        "time_x",
        "value",
        "time_y",
        "value2",
    ]
    pred = joined.op().table.op().predicates[0].op()
    assert pred.left.op().name == pred.right.op().name == 'time'
예제 #8
0
def test_asof_join_with_by():
    left = ibis.table([('time', 'int32'), ('key', 'int32'),
                       ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('key', 'int32'),
                        ('value2', 'double')])
    joined = api.asof_join(left, right, 'time', by='key')
    assert joined.columns == [
        "time_x",
        "key_x",
        "value",
        "time_y",
        "key_y",
        "value2",
    ]
    by = joined.op().table.op().by[0].op()
    assert by.left.op().name == by.right.op().name == 'key'
예제 #9
0
파일: test_table.py 프로젝트: sanjc/ibis
def test_asof_join():
    left = ibis.table([('time', 'int32'), ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('value2', 'double')])
    joined = api.asof_join(left, right, 'time')
    pred = joined.op().predicates[0].op()
    assert pred.left.op().name == pred.right.op().name == 'time'
예제 #10
0
파일: test_table.py 프로젝트: cloudera/ibis
def test_asof_join():
    left = ibis.table([('time', 'int32'), ('value', 'double')])
    right = ibis.table([('time', 'int32'), ('value2', 'double')])
    joined = api.asof_join(left, right, 'time')
    pred = joined.op().predicates[0].op()
    assert pred.left.op().name == pred.right.op().name == 'time'