Width Bucket (Teradata Database) - Teradata Warehouse Miner

Teradata® Warehouse Miner™ User Guide - Volume 2ADS Generation

Product
Teradata Warehouse Miner
Release Number
5.4.6
Published
November 2018
Language
English (United States)
Last Update
2018-12-07
dita:mapPath
gxn1538171534877.ditamap
dita:ditavalPath
ft:empty
dita:id
B035-2301
Product Category
Software

This function is only available when connected to a Teradata database.

An enhanced version of the standard Width Bucket function is supported, calculating the partition number or “width bucket” into which the expression represented by the first argument falls. The equal width partitions are determined by the lower and upper bounds (second and third arguments) and the number of partitions (fourth argument). The result is a value from 0 to the number of partitions plus 1, where 0 and number of partitions plus 1 are assigned to values outside the lower and upper bounds.

The number of partitions must be a number greater than 0 and less than or equal to 2147483646. Note that the Width Bucket of a null value is also null, that the Width Bucket of a value equal to the lower bound is 1, whereas the Width Bucket of a value equal to the upper bound is “number of partitions plus 1”.

The enhancement to the standard function is that a date expression can be directly processed as the value expression with date lower and upper bounds, automatically generating WIDTH_BUCKET (date expression - DATE '1900-01-01', lower bound - DATE '1900-01-01', upper bound - DATE '1900-01-01', partitions). Without these adjustments, the Width Bucket function does not correctly process date expressions.

When dragging a Width Bucket into a variable, the following tree element is created.

Variable Creation > Input > Variables: SQL Elements pane - Arithmetic > Width Bucket

Columns and/or other expressions can be moved over the empty branches of the tree.

There are no special properties for the Width Bucket function.