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

refactor(snowflake): replace array repeat udf with builtin transform function #9177

Merged

Conversation

cpcloud
Copy link
Member

@cpcloud cpcloud commented May 13, 2024

Turns out we can do this without a UDF. Thanks to @krzysztof-kwitt for the idea!

@cpcloud cpcloud added this to the 9.1 milestone May 13, 2024
@cpcloud cpcloud requested a review from gforsyth May 13, 2024 10:23
@gforsyth
Copy link
Member

 🐍(nix) ~githibis-ibisremove-snowflake-array-repeat-udf⚑7
🐚 pytest -m snowflake
================================ test session starts ================================
platform linux -- Python 3.12.2, pytest-8.2.0, pluggy-1.5.0
Using --randomly-seed=3728893895
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)
rootdir: /home/gil/github.com/ibis-project/ibis
configfile: pyproject.toml
plugins: anyio-4.3.0, hypothesis-6.100.4, snapshot-0.9.0, randomly-3.15.0, mock-3.14.0, benchmark-4.0.0, timeout-2.3.1, cov-5.0.0, repeat-0.9.3, clarity-1.0.1, pytest_httpserver-1.0.10, xdist-3.6.1
collected 37373 items / 35676 deselected / 1697 selected                            

ibis/backends/tests/test_dot_sql.py ..........x....x...........x............x [  2%]
..........                                                                    [  3%]
ibis/backends/tests/test_examples.py ....                                     [  3%]
ibis/backends/tests/test_generic.py .............x.........xx........x....... [  5%]
....xx.......x.x......................x.......x............x.......x......... [ 10%]
.x......x.........x........x....x.x..x..............................          [ 14%]
ibis/backends/tests/test_window.py ............x....xx...xx.x......x...x.xxxx [ 16%]
......x....x....                                                              [ 17%]
ibis/backends/tests/test_dataframe_interchange.py ....                        [ 17%]
ibis/backends/tests/tpch/test_h21.py .                                        [ 17%]
ibis/backends/tests/tpch/test_h22.py .                                        [ 17%]
ibis/backends/tests/test_uuid.py ...                                          [ 18%]
ibis/backends/tests/tpch/test_h05.py .                                        [ 18%]
ibis/backends/tests/test_aggregation.py ..x....x...........x...........x....x [ 20%]
...........................x.....x..........x.........x...............x.....x [ 24%]
.....................x...x.....x.                                             [ 26%]
ibis/backends/tests/test_markers.py xxxxxxxxxxxx                              [ 27%]
ibis/backends/tests/test_column.py .x...                                      [ 27%]
ibis/backends/tests/test_string.py .......................x.....x............ [ 30%]
.......................x.........................x...............             [ 34%]
ibis/backends/tests/tpch/test_h15.py .                                        [ 34%]
ibis/backends/tests/tpch/test_h19.py .                                        [ 34%]
ibis/backends/tests/test_api.py .s..........                                  [ 35%]
ibis/backends/tests/test_join.py .........s.................................. [ 37%]
...................s..........s.........                                      [ 39%]
ibis/backends/tests/tpch/test_h11.py .                                        [ 40%]
ibis/backends/tests/test_sql.py .........                                     [ 40%]
ibis/backends/tests/tpch/test_h14.py .                                        [ 40%]
ibis/backends/tests/tpch/test_h08.py .                                        [ 40%]
ibis/backends/tests/tpch/test_h10.py .                                        [ 40%]
ibis/backends/tests/test_register.py ..xxxxx.xxxxx.xxxx...xx                  [ 42%]
ibis/backends/tests/tpch/test_h09.py .                                        [ 42%]
ibis/backends/tests/tpch/test_h16.py .                                        [ 42%]
ibis/backends/tests/test_map.py .x.x.x.xxx.....xxx.xxxx.x.x..xx.xxxx.xx.x.xxx [ 44%]
.xxxxx..x.xx....x...x.xx...xxx..xxxx..xxxx.xxxxxx..x.......xx....x....x.xx..  [ 49%]
ibis/backends/tests/tpch/test_h01.py .                                        [ 49%]
ibis/backends/tests/test_client.py .....x...x.........................x...... [ 51%]
.s.....................x......                                                [ 53%]
ibis/backends/tests/tpch/test_h02.py .                                        [ 53%]
ibis/backends/tests/test_interactive.py ........                              [ 54%]
ibis/backends/tests/tpch/test_h13.py .                                        [ 54%]
ibis/backends/tests/test_struct.py xxx.x...........                           [ 55%]
ibis/backends/tests/tpch/test_h06.py .                                        [ 55%]
ibis/backends/tests/test_numeric.py ...............x........x.........x...... [ 57%]
..x..x................x............x...x..........x..................x....... [ 62%]
..x...............x..x...xx..x....                                            [ 64%]
ibis/backends/tests/test_export.py ............s....x...............x........ [ 66%]
.x...                                                                         [ 66%]
ibis/backends/tests/test_json.py ............                                 [ 67%]
ibis/backends/tests/tpch/test_h18.py .                                        [ 67%]
ibis/backends/tests/test_array.py .x......x..x....x.x.x......x.............x. [ 70%]
...............x...............x..x....xxx...x..........x.....xx............. [ 74%]
..x...............                                                            [ 75%]
ibis/backends/tests/test_param.py .....................                       [ 77%]
ibis/backends/tests/test_set_ops.py .x.xx.x..xx...........                    [ 78%]
ibis/backends/tests/tpch/test_h17.py .                                        [ 78%]
ibis/backends/tests/tpch/test_h12.py .                                        [ 78%]
ibis/backends/tests/test_binary.py .                                          [ 78%]
ibis/backends/tests/test_udf.py ...x.                                         [ 78%]
ibis/backends/tests/test_asof_join.py xxxx                                    [ 79%]
ibis/backends/tests/test_temporal.py x....x.x........x.........x....x.x...x.. [ 81%]
......x.............xx.x.....xx..x......x....x.......x.....x...x..x.x......x. [ 85%]
........x..................x.x........x.                                      [ 88%]
ibis/backends/tests/test_network.py ...                                       [ 88%]
ibis/backends/tests/tpch/test_h03.py .                                        [ 88%]
ibis/backends/tests/tpch/test_h04.py .                                        [ 88%]
ibis/backends/tests/tpch/test_h07.py .                                        [ 88%]
ibis/backends/tests/tpch/test_h20.py .                                        [ 88%]
ibis/backends/snowflake/tests/test_datatypes.py ............................. [ 90%]
.............................                                                 [ 92%]
ibis/backends/tests/test_sql.py s                                             [ 92%]
ibis/backends/tests/test_client.py .......................................... [ 94%]
...........................................................                   [ 98%]
ibis/backends/snowflake/tests/test_compiler.py .                              [ 98%]
ibis/backends/snowflake/tests/test_client.py ...................x..           [ 99%]
ibis/backends/snowflake/tests/test_udf.py ....s.s.                            [100%]

==== 1456 passed, 9 skipped, 35676 deselected, 232 xfailed in 983.21s (0:16:23) =====

snowflake passing

@gforsyth gforsyth merged commit b3abc9a into ibis-project:main May 13, 2024
81 of 82 checks passed
@cpcloud cpcloud deleted the remove-snowflake-array-repeat-udf branch May 13, 2024 13:10
@cpcloud
Copy link
Member Author

cpcloud commented May 13, 2024

Hm, I think we may need to revert this. Apparently transform cannot refer to any outer scope, including column names 😮‍💨

@cpcloud
Copy link
Member Author

cpcloud commented May 13, 2024

I'll put up a PR that adds a test, and will revert this if it fails.

cpcloud added a commit to cpcloud/ibis that referenced this pull request May 13, 2024
cpcloud added a commit to cpcloud/ibis that referenced this pull request May 13, 2024
cpcloud added a commit to cpcloud/ibis that referenced this pull request May 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants