ClickHouse: quantile is read as the exact Quantile, though ClickHouse's quantile is approximate
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 75/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Domain
- backend-api-design
Research direction
Start by reading the ClickHouse dialect’s function mappings and the expression classes for Quantile, ApproxQuantile, and ParameterizedAgg. Trace how the parser handles quantile and quantileExact, then add or update focused parser tests for both calls. Done means the parsed expressions match the expected classes in the issue.
Written by the indexing model from the issue text.
Description
ClickHouse's quantile is approximate, but the ClickHouse dialect reads it into exp.Quantile, SQLGlot's exact quantile:
import sqlglot
type(sqlglot.parse_one("SELECT quantile(0.9)(x)", read="clickhouse").expressions[0]).__name__
# 'Quantile'
type(sqlglot.parse_one("SELECT quantileExact(0.9)(x)", read="clickhouse").expressions[0]).__name__
# 'ParameterizedAgg'
ClickHouse documents quantile as approximate ("Computes an approximate quantile of a numeric data sequence"; it uses reservoir sampling) and quantileExact as the exact one. So the exact class ends up on the approximate function and not on the exact one.
Expected: quantile reads as exp.ApproxQuantile (and quantileExact as exp.Quantile), so that what the tree says about the computation matches ClickHouse's.
Docs: https://clickhouse.com/docs/reference/functions/aggregate-functions/quantile
Checked on main (c321d9f). I used an LLM (Claude) to help narrow this down and write it up.
- Dominant language
- Python
- Stars
- 9.8k
- Forks
- 1.5k
- Avg merge
- 10h 54m
- Merged PRs (30d)
- 310
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from tobymao/sqlglot
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
ClickHouse: DAY_OF_WEEK is read as DayOfWeek, so every call is written back as toDayOfWeek(t, 3)Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
Oracle: qualify quotes USER, UID, ORA_ROWSCN and CONNECT_BY_ISLEAF/ISCYCLE as if they were columnsPossibly taken @georgesittas claimed this today. Open
Difficulty 3/5 1-2 days Newbie friendliness 35/100
tobymao/sqlglot#9468 · 1 comment ·
Maintainers usually reply within 1 day
-
INTERVAL '1 day ago' loses "ago" and becomes a positive intervalPossibly taken @treysp claimed this 1 day ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 35/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
daniel-ospina/tortoise#15014 ·
Maintainers usually reply within 1 day
-
area:api p2 product:business triage:active type:feat
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
cuadrao-ai/argus#2656 ·
Maintainers usually reply within 1 day
-
documentation good first issue help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
-
good first issue tests
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
yeab7505/tenasig#20 · 1 comment ·
Maintainers usually reply within 1 day