malloy
malloy copied to clipboard
Support percentile functions as aggregates
We have gotten a lot of feature requests from users asking for percentile functions. We should support both percentile_cont
, and percentile_disc
. From the Snowflake documentation: "The function PERCENTILE_CONT interpolates between the two closest values, while the function PERCENTILE_DISC chooses the closest value rather than interpolating."
These are supported by DuckDB as aggregates: https://duckdb.org/docs/sql/aggregates#statistical-aggregates
Snowflake supports these as aggregates as well: https://docs.snowflake.com/en/sql-reference/functions/percentile_cont
BigQuery only supports these as window functions, which might make the implementation a bit tricky: https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#percentile_cont