@@ -326,6 +326,11 @@ TEST(ByteRanges, StringViewType) {
326326 std::shared_ptr<Array> str_view_with_nulls = ArrayFromJSON (
327327 utf8_view (), R"( ["short", null, "another long string that requires a buffer"])" );
328328 CheckBufferRanges (str_view_with_nulls, {{0 , 0 , 1 }, {1 , 0 , 48 }, {2 , 0 , 42 }});
329+
330+ CheckBufferRanges (str_view_arr->Slice (1 , 1 ), {{0 , 16 , 16 }, {1 , 0 , 38 }});
331+ CheckBufferRanges (str_view_arr->Slice (0 , 1 ), {{0 , 0 , 16 }, {1 , 0 , 38 }});
332+ CheckBufferRanges (str_view_with_nulls->Slice (2 , 1 ),
333+ {{0 , 0 , 1 }, {1 , 32 , 16 }, {2 , 0 , 42 }});
329334}
330335
331336TEST (ByteRanges, BinaryViewType) {
@@ -337,6 +342,10 @@ TEST(ByteRanges, BinaryViewType) {
337342 std::shared_ptr<Array> bin_view_with_nulls =
338343 ArrayFromJSON (binary_view (), R"( ["AB", null, "CDEFGHIJKLMNOPQRSTUVWXYZ"])" );
339344 CheckBufferRanges (bin_view_with_nulls, {{0 , 0 , 1 }, {1 , 0 , 48 }, {2 , 0 , 24 }});
345+
346+ CheckBufferRanges (bin_view_arr->Slice (1 , 1 ), {{0 , 16 , 16 }, {1 , 0 , 22 }});
347+ CheckBufferRanges (bin_view_with_nulls->Slice (2 , 1 ),
348+ {{0 , 0 , 1 }, {1 , 32 , 16 }, {2 , 0 , 24 }});
340349}
341350
342351using ListViewArrowTypes = ::testing::Types<ListViewType, LargeListViewType>;
@@ -359,6 +368,15 @@ TYPED_TEST(ByteRangesListView, Basic) {
359368 {1 , 0 , 3 * sizeof (offset_type)},
360369 {2 , 0 , 3 * sizeof (offset_type)},
361370 {3 , 0 , 20 }});
371+ CheckBufferRanges (list_view_arr->Slice (2 , 1 ),
372+ {{0 , 2 * sizeof (offset_type), sizeof (offset_type)},
373+ {1 , 2 * sizeof (offset_type), sizeof (offset_type)},
374+ {2 , 0 , 16 }});
375+ CheckBufferRanges (list_view_with_nulls->Slice (2 , 1 ),
376+ {{0 , 0 , 1 },
377+ {1 , 2 * sizeof (offset_type), sizeof (offset_type)},
378+ {2 , 2 * sizeof (offset_type), sizeof (offset_type)},
379+ {3 , 0 , 20 }});
362380}
363381
364382TYPED_TEST (ByteRangesListView, NestedListView) {
0 commit comments