MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / hll_cardinality_estimate

Function hll_cardinality_estimate

nodedb/src/engine/sparse/stats.rs:332–348  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

330
331 #[test]
332 fn hll_cardinality_estimate() {
333 let mut stats = ColumnStats::new();
334 for i in 0..1000 {
335 stats.observe(Some(&serde_json::Value::String(format!("value_{i}"))));
336 }
337 // HLL with 256 registers should be within ~20% of 1000.
338 assert!(
339 stats.distinct_count > 700,
340 "too low: {}",
341 stats.distinct_count
342 );
343 assert!(
344 stats.distinct_count < 1400,
345 "too high: {}",
346 stats.distinct_count
347 );
348 }
349
350 #[test]
351 fn min_max_tracking() {

Callers

nothing calls this directly

Calls 1

observeMethod · 0.45

Tested by

no test coverage detected