MCPcopy Create free account
hub / github.com/apache/arrow / CreateUnalignedArray

Function CreateUnalignedArray

cpp/src/arrow/util/align_util_test.cc:73–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73arrow::Result<std::shared_ptr<Array>> CreateUnalignedArray(const Array& array) {
74 // Slicing by 1 would create an invalid array if the type was wider than
75 // 1 byte so double-check that the array is a 1-byte type
76 EXPECT_EQ(array.type_id(), Type::UINT8);
77 BufferVector sliced_buffers(array.data()->buffers.size(), nullptr);
78 for (std::size_t i = 0; i < array.data()->buffers.size(); ++i) {
79 if (array.data()->buffers[i]) {
80 sliced_buffers[i] = SliceBuffer(array.data()->buffers[i], 1, 2);
81 }
82 }
83 auto sliced_array_data =
84 ArrayData::Make(array.type(), /*length=*/2, std::move(sliced_buffers));
85 return MakeArray(std::move(sliced_array_data));
86}
87
88TEST(BitmapWordAlign, AlignedDataStart) {
89 alignas(8) char buf[136] = {0};

Callers 1

TESTFunction · 0.85

Calls 7

SliceBufferFunction · 0.85
MakeFunction · 0.70
MakeArrayFunction · 0.50
type_idMethod · 0.45
sizeMethod · 0.45
dataMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected