MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / test_nested_list

Function test_nested_list

src/repr/src/row/encode.rs:2623–2657  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

2621
2622 #[mz_ore::test]
2623 fn test_nested_list() {
2624 let desc = RelationDesc::builder()
2625 .with_column(
2626 "a",
2627 SqlScalarType::List {
2628 element_type: Box::new(SqlScalarType::List {
2629 element_type: Box::new(SqlScalarType::Int64),
2630 custom_id: None,
2631 }),
2632 custom_id: None,
2633 }
2634 .nullable(false),
2635 )
2636 .finish();
2637 let mut encoder = <RelationDesc as Schema<Row>>::encoder(&desc).unwrap();
2638
2639 let mut og_row = Row::default();
2640 {
2641 let mut packer = og_row.packer();
2642 packer.push_list_with(|inner| {
2643 inner.push_list([Datum::Int64(1), Datum::Int64(2)]);
2644 inner.push_list([Datum::Int64(5)]);
2645 inner.push_list([Datum::Int64(9), Datum::Int64(99), Datum::Int64(999)]);
2646 });
2647 }
2648
2649 encoder.append(&og_row);
2650 let col = encoder.finish();
2651
2652 let decoder = <RelationDesc as Schema<Row>>::decoder(&desc, col).unwrap();
2653 let mut rnd_row = Row::default();
2654 decoder.decode(0, &mut rnd_row);
2655
2656 assert_eq!(og_row, rnd_row);
2657 }
2658
2659 #[mz_ore::test]
2660 fn test_record() {

Callers

nothing calls this directly

Calls 9

with_columnMethod · 0.80
unwrapMethod · 0.80
packerMethod · 0.80
push_list_withMethod · 0.80
push_listMethod · 0.80
finishMethod · 0.45
nullableMethod · 0.45
appendMethod · 0.45
decodeMethod · 0.45

Tested by

no test coverage detected