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

Method SetInput

cpp/src/arrow/compute/kernels/vector_sort_test.cc:2350–2369  ·  view source on GitHub ↗

Create several test datums from `array`. One of which is the unmodified Array while the rest are chunked variants based on it.

Source from the content-addressed store, hash-verified

2348 // Create several test datums from `array`. One of which is the unmodified Array
2349 // while the rest are chunked variants based on it.
2350 void SetInput(const std::shared_ptr<Array>& array) {
2351 datums_ = {array};
2352 const int64_t length = array->length();
2353 for (int64_t num_chunks : {1, 2, 3}) {
2354 if (num_chunks > length) continue;
2355 ArrayVector chunks;
2356 int64_t offset = 0;
2357 for (int64_t i = 0; i < num_chunks; ++i) {
2358 auto next_offset = offset + length / num_chunks;
2359 if (i + 1 == num_chunks) {
2360 next_offset = length;
2361 }
2362 chunks.push_back(array->Slice(offset, next_offset - offset));
2363 offset = next_offset;
2364 }
2365 auto chunked = ChunkedArray::Make(std::move(chunks), array->type()).ValueOrDie();
2366 DCHECK_EQ(chunked->num_chunks(), num_chunks);
2367 datums_.push_back(std::move(chunked));
2368 }
2369 }
2370
2371 void SetInput(const std::shared_ptr<ChunkedArray>& chunked_array) {
2372 datums_ = {chunked_array};

Callers

nothing calls this directly

Calls 7

push_backMethod · 0.80
ValueOrDieMethod · 0.80
MakeFunction · 0.50
lengthMethod · 0.45
SliceMethod · 0.45
typeMethod · 0.45
num_chunksMethod · 0.45

Tested by

no test coverage detected