(num_rows: usize)
| 430 | } |
| 431 | |
| 432 | fn sparse_union_array(num_rows: usize) -> ArrayRef { |
| 433 | let mut rng = make_rng(); |
| 434 | let num_types = 5; |
| 435 | |
| 436 | let type_ids: Vec<i8> = (0..num_rows) |
| 437 | .map(|_| rng.random_range(0..num_types) as i8) |
| 438 | .collect(); |
| 439 | let (fields, children): (Vec<_>, Vec<_>) = (0..num_types) |
| 440 | .map(|i| { |
| 441 | ( |
| 442 | ( |
| 443 | i as i8, |
| 444 | Arc::new(Field::new(format!("f{i}"), DataType::Int64, true)), |
| 445 | ), |
| 446 | primitive_array::<Int64Type>(num_rows), |
| 447 | ) |
| 448 | }) |
| 449 | .unzip(); |
| 450 | |
| 451 | Arc::new( |
| 452 | UnionArray::try_new( |
| 453 | UnionFields::from_iter(fields), |
| 454 | ScalarBuffer::from(type_ids), |
| 455 | None, |
| 456 | children, |
| 457 | ) |
| 458 | .unwrap(), |
| 459 | ) |
| 460 | } |
| 461 | |
| 462 | fn dense_union_array(num_rows: usize) -> ArrayRef { |
| 463 | let mut rng = make_rng(); |
no test coverage detected
searching dependent graphs…