StarRocks / starrocks

StarRocks, a Linux Foundation project, is a next-generation sub-second MPP OLAP database for full analytics scenarios, including multi-dimensional analytics, real-time analytics, and ad-hoc queries.
https://starrocks.io
Apache License 2.0
8.58k stars 1.73k forks source link

WIDTH_BUCKET function support #12990

Closed vkingnew closed 3 days ago

vkingnew commented 1 year ago

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

wangsimo0 commented 1 year ago

@TBCCC hi could you please reply here so I can assign this to you~?

TBCCC commented 1 year ago

@TBCCC hi could you please reply here so I can assign this to you~? OK thx

wangsimo0 commented 1 year ago

syntax

WIDTH_BUCKET( <expr> , <min_value> , <max_value> , <num_buckets> )

arguments

  1. expr: a numeric value
  2. min/max value: numeric value, cannot be equal, while min value can be greater than max value.
  3. num_buckets: must greater than 0.

notice

  1. when the expression is less than lower bound of the bucket, return 0
  2. when the expression is greater than upper bound of the bucket, return bucket_num+1
  3. return null if any of those arguments is null
github-actions[bot] commented 9 months ago

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!

vkingnew commented 9 months ago

go on developing

github-actions[bot] commented 2 weeks ago

We have marked this issue as stale because it has been inactive for 6 months. If this issue is still relevant, removing the stale label or adding a comment will keep it active. Otherwise, we'll close it in 10 days to keep the issue queue tidy. Thank you for your contribution to StarRocks!