kll_sketch_get_n_double function
Applies to: Databricks Runtime 18.0 and later
Returns the number of items that have been added to a double KLL sketch.
Syntax
kll_sketch_get_n_double ( sketch )
Arguments
sketch: ABINARYexpression containing a serializedDOUBLEKLL 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_double(measurement) AS sketch
FROM VALUES (1.23), (2.34), (3.45) AS T(measurement)
)
SELECT kll_sketch_get_n_double(sketch) FROM sketch_data
3