Skip to content

Commit

Permalink
fix(trino): remove invalid ranking function window frames (#10363)
Browse files Browse the repository at this point in the history
  • Loading branch information
cpcloud authored Oct 24, 2024
1 parent 288d248 commit 348500c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
4 changes: 4 additions & 0 deletions ibis/backends/sql/compilers/trino.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@
from ibis.backends.sql.dialects import Trino
from ibis.backends.sql.rewrites import (
exclude_unsupported_window_frame_from_ops,
exclude_unsupported_window_frame_from_rank,
exclude_unsupported_window_frame_from_row_number,
lower_sample,
split_select_distinct_with_order_by,
)
Expand All @@ -38,6 +40,8 @@ class TrinoCompiler(SQLGlotCompiler):
agg = AggGen(supports_filter=True, supports_order_by=True)

rewrites = (
exclude_unsupported_window_frame_from_row_number,
exclude_unsupported_window_frame_from_rank,
exclude_unsupported_window_frame_from_ops,
*SQLGlotCompiler.rewrites,
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SELECT
NTILE(2) OVER (ORDER BY RAND() ASC ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) - 1 AS "new_col"
NTILE(2) OVER (ORDER BY RAND() ASC) - 1 AS "new_col"
FROM "test" AS "t0"
LIMIT 10

0 comments on commit 348500c

Please sign in to comment.