MCPcopy Create free account
hub / github.com/apache/arrow-rs / test_nullif

Function test_nullif

arrow-select/src/nullif.rs:482–510  ·  view source on GitHub ↗
(values: &Int32Array, filter: &BooleanArray)

Source from the content-addressed store, hash-verified

480 }
481
482 fn test_nullif(values: &Int32Array, filter: &BooleanArray) {
483 let expected: Int32Array = values
484 .iter()
485 .zip(filter.iter())
486 .map(|(a, b)| match b {
487 Some(true) => None,
488 Some(false) | None => a,
489 })
490 .collect();
491
492 let r = nullif(values, filter).unwrap();
493 let r_data = r.to_data();
494 r_data.validate().unwrap();
495
496 assert_eq!(
497 r.as_ref(),
498 &expected,
499 "expected nulls: {:#?}\n\n\
500 result nulls: {:#?}\n\n\\
501 expected values: {:#?}\n\n\
502 result values: {:#?}",
503 expected.nulls(),
504 r.nulls(),
505 expected.values(),
506 r.as_primitive::<Int32Type>().values()
507 );
508 validate_nulls(expected.nulls());
509 validate_nulls(r.nulls());
510 }
511
512 /// Ensures that the null count matches the actual number of nulls.
513 fn validate_nulls(nulls: Option<&NullBuffer>) {

Callers 1

nullif_fuzzFunction · 0.85

Calls 8

nullifFunction · 0.85
validate_nullsFunction · 0.85
collectMethod · 0.80
zipMethod · 0.80
iterMethod · 0.45
to_dataMethod · 0.45
validateMethod · 0.45
nullsMethod · 0.45

Tested by

no test coverage detected