Esempio n. 1
0
def test_bad_call_to_adjust_context():
    op = "not_a_node"
    context = (pd.Timestamp('20170101'), pd.Timestamp('20170103'))
    scope = Scope()
    with pytest.raises(com.IbisError,
                       match=r".*Unsupported input type for adjust context.*"):
        adjust_context(op, scope, context)
Esempio n. 2
0
def compute_time_context_window(op,
                                clients,
                                timecontext: Optional[TimeContext] = None,
                                **kwargs):
    new_timecontexts = [
        timecontext for arg in op.inputs if is_computable_input(arg)
    ]

    if not timecontext:
        return new_timecontexts

    result = adjust_context(op, timecontext=timecontext)

    new_timecontexts = [
        result for arg in op.inputs if is_computable_input(arg)
    ]
    return new_timecontexts
Esempio n. 3
0
def compute_time_context_asof_join(op,
                                   clients,
                                   timecontext: Optional[TimeContext] = None,
                                   **kwargs):
    new_timecontexts = [
        timecontext for arg in op.inputs if is_computable_input(arg)
    ]

    if not timecontext:
        return new_timecontexts

    # right table is the second node in children
    new_timecontexts = [
        new_timecontexts[0],
        adjust_context(op, timecontext=timecontext),
        *new_timecontexts[2:],
    ]
    return new_timecontexts
Esempio n. 4
0
def compute_time_context_window(op: ops.WindowOp,
                                scope: Scope,
                                clients: List[BaseBackend],
                                timecontext: Optional[TimeContext] = None,
                                **kwargs):
    new_timecontexts = [
        timecontext for arg in op.inputs if is_computable_input(arg)
    ]

    if not timecontext:
        return new_timecontexts

    result = adjust_context(op, scope, timecontext)

    new_timecontexts = [
        result for arg in op.inputs if is_computable_input(arg)
    ]
    return new_timecontexts
Esempio n. 5
0
def compute_time_context_asof_join(op: ops.AsOfJoin,
                                   scope: Scope,
                                   clients: List[BaseBackend],
                                   timecontext: Optional[TimeContext] = None,
                                   **kwargs):
    new_timecontexts = [
        timecontext for arg in op.inputs if is_computable_input(arg)
    ]

    if not timecontext:
        return new_timecontexts

    # right table is the second node in children
    new_timecontexts = [
        new_timecontexts[0],
        adjust_context(op, scope, timecontext),
        *new_timecontexts[2:],
    ]
    return new_timecontexts