Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIDTH_BUCKET function support please #42974

Closed
vkingnew opened this issue Nov 4, 2022 · 0 comments
Closed

WIDTH_BUCKET function support please #42974

vkingnew opened this issue Nov 4, 2022 · 0 comments
Labels
feature warmup task The task for new ClickHouse team members. Low risk, moderate complexity, no urgency.

Comments

@vkingnew
Copy link

vkingnew commented Nov 4, 2022

function width_bucket had supported by oracle and postgresql,hive,sparksql,impala,snowflake and databricks.
please add the same name function and have the same feature.
please refer to:
https://www.postgresql.org/docs/15/functions-math.html
https://docs.snowflake.com/en/sql-reference/functions/width_bucket.html

width_bucket ( operand numeric, low numeric, high numeric, count integer ) → integer
width_bucket ( operand double precision, low double precision, high double precision, count integer ) → integer

Returns the number of the bucket in which operand falls in a histogram having count equal-width buckets spanning the range low to high. Returns 0 or count+1 for an input outside that range.width_bucket(5.35, 0.024, 10.06, 5) → 3

width_bucket ( operand anycompatible, thresholds anycompatiblearray ) → integer
Returns the number of the bucket in which operand falls given an array listing the lower bounds of the buckets. Returns 0 for an input less than the first lower bound. operand and the array elements can be of any type having standard comparison operators. The thresholds array must be sorted, smallest first, or unexpected results will be obtained.width_bucket(now(), array['yesterday', 'today', 'tomorrow']::timestamptz[]) → 2

@alexey-milovidov alexey-milovidov added the warmup task The task for new ClickHouse team members. Low risk, moderate complexity, no urgency. label Nov 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature warmup task The task for new ClickHouse team members. Low risk, moderate complexity, no urgency.
Projects
None yet
Development

No branches or pull requests

3 participants