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

Function test_struct_nulls

datafusion/common/src/scalar/mod.rs:9404–9509  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

9402
9403 #[test]
9404 fn test_struct_nulls() {
9405 let fields_b = Fields::from(vec![
9406 Field::new("ba", DataType::UInt64, true),
9407 Field::new("bb", DataType::UInt64, true),
9408 ]);
9409 let fields = Fields::from(vec![
9410 Field::new("a", DataType::UInt64, true),
9411 Field::new("b", DataType::Struct(fields_b.clone()), true),
9412 ]);
9413
9414 let struct_value = vec![
9415 (
9416 Arc::clone(&fields[0]),
9417 Arc::new(UInt64Array::from(vec![Some(1)])) as ArrayRef,
9418 ),
9419 (
9420 Arc::clone(&fields[1]),
9421 Arc::new(StructArray::from(vec![
9422 (
9423 Arc::clone(&fields_b[0]),
9424 Arc::new(UInt64Array::from(vec![Some(2)])) as ArrayRef,
9425 ),
9426 (
9427 Arc::clone(&fields_b[1]),
9428 Arc::new(UInt64Array::from(vec![Some(3)])) as ArrayRef,
9429 ),
9430 ])) as ArrayRef,
9431 ),
9432 ];
9433
9434 let struct_value_with_nulls = vec![
9435 (
9436 Arc::clone(&fields[0]),
9437 Arc::new(UInt64Array::from(vec![Some(1)])) as ArrayRef,
9438 ),
9439 (
9440 Arc::clone(&fields[1]),
9441 Arc::new(StructArray::from((
9442 vec![
9443 (
9444 Arc::clone(&fields_b[0]),
9445 Arc::new(UInt64Array::from(vec![Some(2)])) as ArrayRef,
9446 ),
9447 (
9448 Arc::clone(&fields_b[1]),
9449 Arc::new(UInt64Array::from(vec![Some(3)])) as ArrayRef,
9450 ),
9451 ],
9452 Buffer::from(&[0]),
9453 ))) as ArrayRef,
9454 ),
9455 ];
9456
9457 let scalars = vec![
9458 // all null
9459 ScalarValue::Struct(Arc::new(StructArray::from((
9460 struct_value.clone(),
9461 Buffer::from(&[0]),

Callers

nothing calls this directly

Calls 8

is_nullFunction · 0.50
concatFunction · 0.50
to_stringMethod · 0.45
splitMethod · 0.45
cloneMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
as_refMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…