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

Function test_struct

arrow-array/src/ffi.rs:1509–1537  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

1507
1508 #[test]
1509 fn test_struct() -> Result<()> {
1510 let inner = StructArray::from(vec![
1511 (
1512 Arc::new(Field::new("a1", DataType::Boolean, false)),
1513 Arc::new(BooleanArray::from(vec![true, true, false, false])) as Arc<dyn Array>,
1514 ),
1515 (
1516 Arc::new(Field::new("a2", DataType::UInt32, false)),
1517 Arc::new(UInt32Array::from(vec![1, 2, 3, 4])),
1518 ),
1519 ]);
1520
1521 let array = StructArray::from(vec![
1522 (
1523 Arc::new(Field::new("a", inner.data_type().clone(), false)),
1524 Arc::new(inner) as Arc<dyn Array>,
1525 ),
1526 (
1527 Arc::new(Field::new("b", DataType::Boolean, false)),
1528 Arc::new(BooleanArray::from(vec![false, false, true, true])) as Arc<dyn Array>,
1529 ),
1530 (
1531 Arc::new(Field::new("c", DataType::UInt32, false)),
1532 Arc::new(UInt32Array::from(vec![42, 28, 19, 31])),
1533 ),
1534 ]);
1535 let data = array.into_data();
1536 test_round_trip(&data)
1537 }
1538
1539 #[test]
1540 fn test_dictionary() -> Result<()> {

Callers

nothing calls this directly

Calls 2

test_round_tripFunction · 0.70
into_dataMethod · 0.45

Tested by

no test coverage detected