Returns the bucket number to which an operand is assigned in a histogram of equal-width buckets.
Syntax
1width_bucket(<operand>, <b1>, <b2>, <count>int)
Arguments
Required
<operand>: The value to assign to a bucket.
<b1>: The lower bound of the histogram range.
<b2>: The upper bound of the histogram range.
<count>: The number of equal-width buckets spanning the range b1 to b2.
Returns
Returns the bucket number as an int. The lower bound b1 is included in the first bucket. Returns 0 for an input below the range, or count+1 for an input at or above the upper bound b2.
Considerations
count must be greater than zero, and b1 and b2 can’t be equal. Otherwise, the function returns an error.
Reverse bounds (b1 greater than b2) to define a descending histogram.
Arguments can mix numeric types.
Examples
Assign a Value to a Bucket
Determine which histogram bucket a value falls into.