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

Method GetNextChunkSpan

cpp/src/arrow/compute/exec.cc:373–404  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

371}
372
373int64_t ExecSpanIterator::GetNextChunkSpan(int64_t iteration_size, ExecSpan* span) {
374 for (size_t i = 0; i < args_->size() && iteration_size > 0; ++i) {
375 // If the argument is not a chunked array, it's either a Scalar or Array,
376 // in which case it doesn't influence the size of this span
377 if (!args_->at(i).is_chunked_array()) {
378 continue;
379 }
380 const ChunkedArray* arg = args_->at(i).chunked_array().get();
381 if (arg->num_chunks() == 0) {
382 iteration_size = 0;
383 continue;
384 }
385 const Array* current_chunk;
386 while (true) {
387 current_chunk = arg->chunk(chunk_indexes_[i]).get();
388 if (value_positions_[i] == current_chunk->length()) {
389 // Chunk is zero-length, or was exhausted in the previous
390 // iteration. Move to the next chunk
391 ++chunk_indexes_[i];
392 current_chunk = arg->chunk(chunk_indexes_[i]).get();
393 span->values[i].SetArray(*current_chunk->data());
394 value_positions_[i] = 0;
395 value_offsets_[i] = current_chunk->offset();
396 continue;
397 }
398 break;
399 }
400 iteration_size =
401 std::min(current_chunk->length() - value_positions_[i], iteration_size);
402 }
403 return iteration_size;
404}
405
406bool ExecSpanIterator::Next(ExecSpan* span) {
407 if (!initialized_) {

Callers

nothing calls this directly

Calls 8

chunked_arrayMethod · 0.80
sizeMethod · 0.45
getMethod · 0.45
num_chunksMethod · 0.45
lengthMethod · 0.45
SetArrayMethod · 0.45
dataMethod · 0.45
offsetMethod · 0.45

Tested by

no test coverage detected