()
| 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() { |