| 246 | |
| 247 | #[test] |
| 248 | fn mbr_categorical_attr_stats() { |
| 249 | let mut b = MbrBuilder::new(1, 1); |
| 250 | b.fold(&[CoordValue::Int64(0)], &[CellValue::String("a".into())]); |
| 251 | b.fold(&[CoordValue::Int64(1)], &[CellValue::String("b".into())]); |
| 252 | b.fold(&[CoordValue::Int64(2)], &[CellValue::String("a".into())]); |
| 253 | let m = b.build(); |
| 254 | match &m.attr_stats[0] { |
| 255 | AttrStats::Categorical { |
| 256 | distinct, |
| 257 | null_count, |
| 258 | } => { |
| 259 | assert_eq!(*distinct, 2); |
| 260 | assert_eq!(*null_count, 0); |
| 261 | } |
| 262 | other => panic!("expected Categorical, got {other:?}"), |
| 263 | } |
| 264 | } |
| 265 | } |