You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues-all@impala.apache.org by "ASF subversion and git services (JIRA)" <ji...@apache.org> on 2018/06/30 17:16:00 UTC

[jira] [Commented] (IMPALA-4848) add WIDTH_BUCKET() function

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

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

Commit dde930830b763f58e2f2e73b8b0fe265c4c33f2b in impala's branch refs/heads/master from aphadke
[ https://git-wip-us.apache.org/repos/asf?p=impala.git;h=dde9308 ]

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 <im...@cloudera.com>
Tested-by: Impala Public Jenkins <im...@cloudera.com>


> 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
>
> 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: issues-all-unsubscribe@impala.apache.org
For additional commands, e-mail: issues-all-help@impala.apache.org