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

Method Next

cpp/src/arrow/chunked_array.cc:288–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

286namespace internal {
287
288bool MultipleChunkIterator::Next(std::shared_ptr<Array>* next_left,
289 std::shared_ptr<Array>* next_right) {
290 if (pos_ == length_) return false;
291
292 // Find non-empty chunk
293 std::shared_ptr<Array> chunk_left, chunk_right;
294 while (true) {
295 chunk_left = left_.chunk(chunk_idx_left_);
296 chunk_right = right_.chunk(chunk_idx_right_);
297 if (chunk_pos_left_ == chunk_left->length()) {
298 chunk_pos_left_ = 0;
299 ++chunk_idx_left_;
300 continue;
301 }
302 if (chunk_pos_right_ == chunk_right->length()) {
303 chunk_pos_right_ = 0;
304 ++chunk_idx_right_;
305 continue;
306 }
307 break;
308 }
309 // Determine how big of a section to return
310 int64_t iteration_size = std::min(chunk_left->length() - chunk_pos_left_,
311 chunk_right->length() - chunk_pos_right_);
312
313 *next_left = chunk_left->Slice(chunk_pos_left_, iteration_size);
314 *next_right = chunk_right->Slice(chunk_pos_right_, iteration_size);
315
316 pos_ += iteration_size;
317 chunk_pos_left_ += iteration_size;
318 chunk_pos_right_ += iteration_size;
319 return true;
320}
321
322} // namespace internal
323} // namespace arrow

Callers

nothing calls this directly

Calls 2

lengthMethod · 0.45
SliceMethod · 0.45

Tested by

no test coverage detected