This is an automated email from the ASF dual-hosted git repository. dzamo pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/drill-site.git
commit e893ec7f04c877d57f3b7602701a8b76e7c1f4ee Author: James Turton <[email protected]> AuthorDate: Fri Mar 3 13:24:03 2023 +0200 Document new statistical functions (fixup). --- .../sql-reference/sql-functions/015-statistical.md | 37 ++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/_docs/en/sql-reference/sql-functions/015-statistical.md b/_docs/en/sql-reference/sql-functions/015-statistical.md new file mode 100644 index 000000000..9e9497f76 --- /dev/null +++ b/_docs/en/sql-reference/sql-functions/015-statistical.md @@ -0,0 +1,37 @@ +--- +title: "Statistical" +slug: "Statistical" +parent: "SQL Functions" +--- + +Drill supports the scalar statistical functions shown in the following table. + +## Table of statistical functions + +| Function | Return Type | Description | +| ------------ | ----------- | ------------------------------------------------------------------------------------------------------------------------------ | +| width_bucket | INT | Returns the 1-based bucket index of the value after dividing the interval between min and max into the given number of buckets | + +## WIDTH_BUCKET + +Returns the 1-based bucket index of _value_ after dividing the interval between _min_ and_ max_ into the given number of buckets. A _value_ that falls outside the given range are given an index of 0 (_value_ < _min_) or _buckets_ + 1 (_value_ > _max_). + +### WIDTH_BUCKET Syntax + +``` +WIDTH_BUCKET( value, min, max, buckets ) +``` + +### WIDTH_BUCKET Examples + +``` +apache drill> select width_bucket(3, 0, 10, 5); +EXPR$0 2 + +1 row selected (0.201 seconds) + +apache drill> select width_bucket(1000, 0, 10, 5); +EXPR$0 6 + +1 row selected (0.131 seconds) +```
