crate / crate/crate

Implement percentile_disc function

Open
#14,548 0 comments 1 reaction 0 assignees View on GitHub
complexity: no estimate feature: sql: aggregations tool: jupySQL
Dominant language
Java
Stars
4.4k
Forks
616
Avg merge
14h 49m
Merged PRs (30d)
206

Description

### Problem Statement

This function is part of the Postgres dialect, see it here https://www.postgresql.org/docs/9.4/functions-aggregate.html, and is not currently supported by CrateDB.

This compatibility issue was identified when using the jupySQL with the following command:
`%sqlplot boxplot --table history_tsx --column value`

The command generated the following query, which output an error, saying the `percentile_disc` function is not available.

```
SELECT
percentile_disc([0.25, 0.50, 0.75]) WITHIN GROUP (ORDER BY "value") AS percentiles,
AVG("value") AS mean,
COUNT(*) AS N
FROM "history_tsx"
```

### Possible Solutions

```
SELECT
percentile_disc([0.25, 0.50, 0.75]) WITHIN GROUP (ORDER BY "value") AS percentiles
FROM table_ex
```

### Considered Alternatives

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.