kll_sketch_get_n_float function
Applies to: Databricks Runtime 18.0 and later
Returns the number of items that have been added to a float KLL sketch.
Syntax
kll_sketch_get_n_float ( sketch )
Arguments
sketch: ABINARYexpression containing a serializedFLOATKLL sketch.
Returns
A BIGINT representing the total count of items in the sketch.
Notes
- Returns the exact count of items added, not an estimate.
- Returns 0 for an empty sketch.
Examples
SQL
> WITH sketch_data AS (
SELECT kll_sketch_agg_float(score) AS sketch
FROM VALUES (1.5), (2.3) AS T(score)
)
SELECT kll_sketch_get_n_float(sketch) FROM sketch_data
2