Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(snowflake): implement support for asof_join API #9180

Merged
merged 1 commit into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions ibis/backends/snowflake/compiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -656,3 +656,18 @@
expressions=[param],
),
)

def visit_JoinLink(self, op, *, how, table, predicates):
assert (

Check warning on line 661 in ibis/backends/snowflake/compiler.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/snowflake/compiler.py#L661

Added line #L661 was not covered by tests
predicates or how == "cross"
), "expected non-empty predicates when not a cross join"

if how == "asof":
# the asof join match condition is always the first predicate by
# construction
match_condition, *predicates = predicates
on = sg.and_(*predicates) if predicates else None
return sge.Join(

Check warning on line 670 in ibis/backends/snowflake/compiler.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/snowflake/compiler.py#L668-L670

Added lines #L668 - L670 were not covered by tests
this=table, kind=how, on=on, match_condition=match_condition
)
return super().visit_JoinLink(op, how=how, table=table, predicates=predicates)

Check warning on line 673 in ibis/backends/snowflake/compiler.py

View check run for this annotation

Codecov / codecov/patch

ibis/backends/snowflake/compiler.py#L673

Added line #L673 was not covered by tests
2 changes: 0 additions & 2 deletions ibis/backends/tests/test_asof_join.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ def time_keyed_right(time_keyed_df2):
@pytest.mark.notyet(
[
"datafusion",
"snowflake",
"trino",
"postgres",
"mysql",
Expand Down Expand Up @@ -126,7 +125,6 @@ def test_asof_join(con, time_left, time_right, time_df1, time_df2, direction, op
@pytest.mark.notyet(
[
"datafusion",
"snowflake",
"trino",
"postgres",
"mysql",
Expand Down
Loading