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

Function test_view_buffer_append_view

parquet/src/arrow/buffer/view_buffer.rs:110–133  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

108
109 #[test]
110 fn test_view_buffer_append_view() {
111 let mut buffer = ViewBuffer::with_capacity(0);
112 let data = b"0123456789long string to test string view";
113 let string_buffer = Buffer::from(data);
114 let block_id = buffer.append_block(string_buffer);
115
116 buffer.views.push(make_view(&data[0..1], block_id, 0));
117 buffer.views.push(make_view(&data[1..10], block_id, 1));
118 buffer.views.push(make_view(&data[10..41], block_id, 10));
119
120 let array = buffer.into_array(None, &ArrowType::Utf8View);
121 let string_array = array
122 .as_any()
123 .downcast_ref::<arrow::array::StringViewArray>()
124 .unwrap();
125 assert_eq!(
126 string_array.iter().collect::<Vec<_>>(),
127 vec![
128 Some("0"),
129 Some("123456789"),
130 Some("long string to test string view"),
131 ]
132 );
133 }
134
135 #[test]
136 fn test_view_buffer_pad_null() {

Callers

nothing calls this directly

Calls 5

make_viewFunction · 0.85
append_blockMethod · 0.45
pushMethod · 0.45
into_arrayMethod · 0.45
as_anyMethod · 0.45

Tested by

no test coverage detected