ibis-project / ibis

the portable Python dataframe library
https://ibis-project.org
Apache License 2.0
4.42k stars 544 forks source link

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

Closed cpcloud closed 1 month ago

cpcloud commented 1 month ago

Adds support for asof_join to the Snowflake backend.

Depends on #9181.

cpcloud commented 1 month ago

This is in draft mode because there's some apparently incorrect timestamp conversion happening somewhere. Fixed in #9181.

cpcloud commented 1 month ago

Going to split out the Parquet timestamp fix into a separate PR.

cpcloud commented 1 month ago

Snowflake is passing all as of join tests:

…/ibis on  snowflake-asof-join is 📦 v9.0.0 via 🐍 v3.12.2 via ❄️   impure (ibis-3.12.2-env)
❯ pytest -m snowflake ibis/backends/tests/test_asof_join.py -vv
======================================================================================== test session starts =========================================================================================
platform linux -- Python 3.12.2, pytest-8.2.0, pluggy-1.5.0 -- /nix/store/h1gvc0gq3awn43bf6bbbzjciydwv232i-python3-3.12.2-env/bin/python3.12
cachedir: .pytest_cache
benchmark: 4.0.0 (defaults: timer=time.perf_counter disable_gc=False min_rounds=5 min_time=0.000005 max_time=1.0 calibration_precision=10 warmup=False warmup_iterations=100000)
Using --randomly-seed=3549411145
collected 80 items / 76 deselected / 4 selected

ibis/backends/tests/test_asof_join.py::test_asof_join[snowflake-forward-le] PASSED [ 25%]
ibis/backends/tests/test_asof_join.py::test_asof_join[snowflake-backward-ge] PASSED [ 50%]
ibis/backends/tests/test_asof_join.py::test_keyed_asof_join_with_tolerance[snowflake-backward-ge] PASSED [ 75%]
ibis/backends/tests/test_asof_join.py::test_keyed_asof_join_with_tolerance[snowflake-forward-le] PASSED [100%]

================================================================================= 4 passed, 76 deselected in 28.17s ==================================================================================