()
| 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() { |
nothing calls this directly
no test coverage detected