New scalar function WIDTH_BUCKET

Details

Detail name Value
Changelog Number 18883
Type New Feature
Status Resolved
Fix Versions Exasol 8.25.0
Resolution Date 2024-02-15

New Feature

The scalar function WIDTH_BUCKET from the SQL standard is now supported. WIDTH_BUCKET lets you construct equi-width histograms, in which the histogram range is divided into intervals that have identical size.

It receives 4 arguments: operandbound1bound2 and bucket_count  and assigns operand  to a corresponding bucket. operandbound1 and bound2 must be numeric, bucket_count must be exact numeric with scale = 0.

For more details, see WIDTH_BUCKET in the documentation.

Examples

SELECT WIDTH_BUCKET(0.5, 0, 3, 3); -- result is 1
-- 0.....1....2....3
-- [....)[...)[...)
--   ↑
-- .0.5............

SELECT WIDTH_BUCKET(1, 0, 3, 3);   -- result is 2
-- 0.....1....2....3
-- [....)[...)[...)
--       ↑
-- ......1.........

Changed behavior

Added a new scalar function WIDTH_BUCKET.