mirror of
https://github.com/apache/impala.git
synced 2025-12-30 03:01:44 -05:00
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 <impala-public-jenkins@cloudera.com> Tested-by: Impala Public Jenkins <impala-public-jenkins@cloudera.com>