-
Notifications
You must be signed in to change notification settings - Fork 609
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(snowflake): manually construct quantile calls with
WITHIN GROUP
(…
- Loading branch information
Showing
3 changed files
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
...nds/snowflake/tests/snapshots/test_compiler/test_more_than_one_quantile/two_quantiles.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
SELECT | ||
PERCENTILE_CONT(0.25) WITHIN GROUP (ORDER BY | ||
"t0"."ROW_COUNT") AS "quantile_0_25", | ||
PERCENTILE_CONT(0.75) WITHIN GROUP (ORDER BY | ||
"t0"."ROW_COUNT") AS "quantile_0_75" | ||
FROM "t" AS "t0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
from __future__ import annotations | ||
|
||
import ibis | ||
from ibis import _ | ||
|
||
|
||
def test_more_than_one_quantile(snapshot): | ||
tables = ibis.table(name="t", schema={"ROW_COUNT": "int"}) | ||
|
||
expr = tables.aggregate( | ||
quantile_0_25=_.ROW_COUNT.quantile(0.25), | ||
quantile_0_75=_.ROW_COUNT.quantile(0.75), | ||
) | ||
|
||
sql = ibis.to_sql(expr, dialect="snowflake") | ||
snapshot.assert_match(sql, "two_quantiles.sql") |