Skip to main content

build_histogram

Function build_histogram 

Source
pub fn build_histogram(sorted_values: &[String]) -> Vec<String>
Expand description

Build an equi-depth histogram over a (sorted) sample of textual column values. Returns the 101 boundary strings, or an empty vec when the input has no non-NULL values.

The caller sorts the sample via the column’s natural ordering (TEXT lexicographic, INT decimal, etc.) and hands us the already-stringified values — we don’t try to reason about types here. Equi-depth means each consecutive pair of bounds spans approximately sample.len() / NUM_BUCKETS values; selectivity estimation in v6.2.2 walks bounds directly.