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

Function MakeArrayFromValidBytes

cpp/src/arrow/array/array_test.cc:270–285  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

268}
269
270Status MakeArrayFromValidBytes(const std::vector<uint8_t>& v, MemoryPool* pool,
271 std::shared_ptr<Array>* out) {
272 int64_t null_count = v.size() - std::accumulate(v.begin(), v.end(), 0);
273
274 ARROW_ASSIGN_OR_RAISE(auto null_buf, internal::BytesToBits(v));
275
276 TypedBufferBuilder<int32_t> value_builder(pool);
277 for (size_t i = 0; i < v.size(); ++i) {
278 RETURN_NOT_OK(value_builder.Append(0));
279 }
280
281 std::shared_ptr<Buffer> values;
282 RETURN_NOT_OK(value_builder.Finish(&values));
283 *out = std::make_shared<Int32Array>(v.size(), values, null_buf, null_count);
284 return Status::OK();
285}
286
287TEST_F(TestArray, TestEquality) {
288 std::shared_ptr<Array> array, equal_array, unequal_array;

Callers 1

TEST_FFunction · 0.85

Calls 6

OKFunction · 0.50
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
AppendMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected