Applies to: ✅ Data 360 SQL ✅ Tableau Hyper API
Encodes each array element into a single bit, compressing the vector by approximately 32x.
Syntax
binary_quantize(<array>)
Arguments
Required
<array>: The vector to quantize (array(real)orarray(double-precision)).
Returns
Returns a bytea value where each bit represents whether the corresponding array element is greater than 0 (1) or not (0).
Considerations
- Elements greater than 0 are encoded as 1, all others (including 0 and negative values) as 0.
- The compression ratio is approximately 32x.
Examples
Quantize a Vector
Convert a numeric vector to binary representation.
SELECT binary_quantize(ARRAY[-5, -3, 2, 6]) AS result;
Returns '0011', where negative values become 0 and positive values become 1.