| 371 | } |
| 372 | |
| 373 | int64_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 | |
| 406 | bool ExecSpanIterator::Next(ExecSpan* span) { |
| 407 | if (!initialized_) { |
nothing calls this directly
no test coverage detected