MCPcopy Create free account
hub / github.com/apache/impala / CopyRows

Method CopyRows

be/src/runtime/row-batch.cc:504–527  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

502}
503
504void RowBatch::CopyRows(RowBatch* src, int num_rows, int src_offset, int dst_offset) {
505 DCHECK_GT(num_rows, 0);
506 DCHECK_GE(num_tuples_per_row_, src->num_tuples_per_row_);
507 DCHECK_GE(src_offset, 0);
508 DCHECK_GE(dst_offset, 0);
509 DCHECK_GE(capacity_, num_rows + dst_offset);
510 DCHECK_GE(src->num_rows_, num_rows + src_offset);
511 bool same_layout = num_tuples_per_row_ == src->num_tuples_per_row_;
512 if (same_layout) {
513 // Fast path, single copy.
514 TupleRow* dst_row = GetRow(dst_offset);
515 TupleRow* src_row = src->GetRow(src_offset);
516 memcpy(dst_row, src_row, num_rows * num_tuples_per_row_ * sizeof(Tuple*));
517 return;
518 }
519 // Slow path, null tuples and copy prefixes.
520 DCHECK_GT(num_tuples_per_row_, src->num_tuples_per_row_);
521 for (int i = 0; i < num_rows; i++) {
522 TupleRow* dst_row = GetRow(dst_offset + i);
523 TupleRow* src_row = src->GetRow(src_offset + i);
524 ClearRow(dst_row);
525 src->CopyRow(src_row, dst_row);
526 }
527}
528
529} // namespace impala

Callers

nothing calls this directly

Calls 2

CopyRowMethod · 0.80
GetRowMethod · 0.45

Tested by

no test coverage detected