[ 
https://issues.apache.org/jira/browse/IMPALA-4848?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16776608#comment-16776608
 ] 

ASF subversion and git services commented on IMPALA-4848:
---------------------------------------------------------

Commit 16276f4e1f55d973709f6c568a673aff6f308b7f in impala's branch 
refs/heads/2.x from aphadke
[ https://gitbox.apache.org/repos/asf?p=impala.git;h=16276f4 ]

IMPALA-4848: Add WIDTH_BUCKET() function

Syntax :
width_bucket(expr decimal, min_val decimal, max_val decimal,
  num_buckets int)

This function creates equiwidth histograms , where the histogram range
is divided into num_buckets buckets having identical sizes. This
function returns the bucket in which the expr value would fall. min_val
and max_val are the minimum and maximum value of the histogram range
respectively.

-> This function returns NULL if expr is a NULL.
-> This function returns 0 if expr < min_val
-> This function returns num_buckets + 1 if expr > max_val

 E.g.
[localhost:21000] > select width_bucket(8, 1, 20, 3);
+---------------------------+
| width_bucket(8, 1, 20, 3) |
+---------------------------+
| 2                         |
+---------------------------+

Change-Id: I081bc916b1bef7b929ca161a9aade3b54c6b858f
Reviewed-on: http://gerrit.cloudera.org:8080/6023
Reviewed-by: Impala Public Jenkins <[email protected]>
Tested-by: Impala Public Jenkins <[email protected]>


> add WIDTH_BUCKET() function
> ---------------------------
>
>                 Key: IMPALA-4848
>                 URL: https://issues.apache.org/jira/browse/IMPALA-4848
>             Project: IMPALA
>          Issue Type: New Feature
>          Components: Backend, Frontend
>    Affects Versions: Product Backlog
>            Reporter: Greg Rahn
>            Assignee: Anuj Phadke
>            Priority: Major
>              Labels: ansi-sql, built-in-function, ramp-up, sql-language
>             Fix For: Impala 2.13.0, Impala 3.1.0
>
>
> Add the built-in function 
> {{WIDTH_BUCKET (expr, min_value, max_value, num_buckets)}}
> {{<width bucket function>}} is a function of four arguments, returning an 
> integer between 0 (zero) and the value of the final argument plus 1 (one), by 
> assigning the first argument to an equi-width partitioning of the range of 
> numbers between the second and third arguments. Values outside the range 
> between the second and third arguments are assigned to either 0 (zero) or the 
> value of the final argument plus 1 (one).
> References:
> * 
> [Vertica|https://my.vertica.com/docs/8.0.x/HTML/index.htm#Authoring/SQLReferenceManual/Functions/Mathematical/WIDTH_BUCKET.htm]
> * 
> [Oracle|http://docs.oracle.com/database/121/SQLRF/functions250.htm#SQLRF06163]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to