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

Function test_offset_buffer_append

parquet/src/arrow/buffer/offset_buffer.rs:217–231  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

215
216 #[test]
217 fn test_offset_buffer_append() {
218 let mut buffer = OffsetBuffer::<i64>::with_capacity(0);
219 buffer.try_push("hello".as_bytes(), true).unwrap();
220 buffer.try_push("bar".as_bytes(), true).unwrap();
221 buffer
222 .extend_from_dictionary(&[1, 3, 0, 2], &[0, 2, 4, 5, 6], "abcdef".as_bytes())
223 .unwrap();
224
225 let array = buffer.into_array(None, ArrowType::LargeUtf8);
226 let strings = array.as_any().downcast_ref::<LargeStringArray>().unwrap();
227 assert_eq!(
228 strings.iter().map(|x| x.unwrap()).collect::<Vec<_>>(),
229 vec!["hello", "bar", "cd", "f", "ab", "e"]
230 )
231 }
232
233 #[test]
234 fn test_offset_buffer() {

Callers

nothing calls this directly

Calls 5

try_pushMethod · 0.80
as_bytesMethod · 0.45
into_arrayMethod · 0.45
as_anyMethod · 0.45

Tested by

no test coverage detected