MCPcopy Create free account
hub / github.com/apache/datafusion / scatter_dictionary_test

Function scatter_dictionary_test

datafusion/physical-expr-common/src/utils.rs:587–613  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

585
586 #[test]
587 fn scatter_dictionary_test() -> Result<()> {
588 use arrow::datatypes::Int8Type;
589
590 let values = StringArray::from(vec!["a", "b"]);
591 let truthy = Arc::new(
592 DictionaryArray::<Int8Type>::try_new(
593 arrow::array::Int8Array::from(vec![0, 1, 0]),
594 Arc::new(values),
595 )
596 .unwrap(),
597 );
598 let mask = BooleanArray::from(vec![true, false, true, true, false]);
599
600 let result = scatter(&mask, truthy.as_ref())?;
601 let result = result
602 .as_any()
603 .downcast_ref::<DictionaryArray<Int8Type>>()
604 .unwrap();
605
606 assert_eq!(result.len(), 5);
607 assert!(result.is_valid(0));
608 assert!(result.is_null(1));
609 assert!(result.is_valid(2));
610 assert!(result.is_valid(3));
611 assert!(result.is_null(4));
612 Ok(())
613 }
614
615 #[test]
616 fn scatter_fixed_size_binary_test() -> Result<()> {

Callers

nothing calls this directly

Calls 4

newFunction · 0.85
scatterFunction · 0.85
as_refMethod · 0.45
as_anyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…