Create several test datums from `array`. One of which is the unmodified Array while the rest are chunked variants based on it.
| 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}; |
nothing calls this directly
no test coverage detected