()
| 1214 | |
| 1215 | #[test] |
| 1216 | fn test_null_union() { |
| 1217 | for mode in [UnionMode::Sparse, UnionMode::Dense] { |
| 1218 | let data_type = DataType::Union( |
| 1219 | UnionFields::try_new( |
| 1220 | vec![2, 1], |
| 1221 | vec![ |
| 1222 | Field::new("foo", DataType::Int32, true), |
| 1223 | Field::new("bar", DataType::Int64, true), |
| 1224 | ], |
| 1225 | ) |
| 1226 | .unwrap(), |
| 1227 | mode, |
| 1228 | ); |
| 1229 | let array = new_null_array(&data_type, 4); |
| 1230 | |
| 1231 | let array = as_union_array(array.as_ref()); |
| 1232 | assert_eq!(array.len(), 4); |
| 1233 | assert_eq!(array.null_count(), 0); |
| 1234 | assert_eq!(array.logical_null_count(), 4); |
| 1235 | |
| 1236 | for i in 0..4 { |
| 1237 | let a = array.value(i); |
| 1238 | assert_eq!(a.len(), 1); |
| 1239 | assert_eq!(a.null_count(), 1); |
| 1240 | assert_eq!(a.logical_null_count(), 1); |
| 1241 | assert!(a.is_null(0)) |
| 1242 | } |
| 1243 | |
| 1244 | array.to_data().validate_full().unwrap(); |
| 1245 | } |
| 1246 | } |
| 1247 | |
| 1248 | #[test] |
| 1249 | #[allow(unused_parens)] |
nothing calls this directly
no test coverage detected