| 407 | } |
| 408 | |
| 409 | void RowBatch::AcquireState(RowBatch* src) { |
| 410 | DCHECK(row_desc_->LayoutEquals(*src->row_desc_)) << row_desc_->DebugString() << "\n" |
| 411 | << src->row_desc_->DebugString(); |
| 412 | DCHECK_EQ(num_tuples_per_row_, src->num_tuples_per_row_); |
| 413 | DCHECK_EQ(tuple_ptrs_size_, src->tuple_ptrs_size_); |
| 414 | |
| 415 | // The destination row batch should be empty. |
| 416 | DCHECK(!needs_deep_copy_); |
| 417 | DCHECK_EQ(num_rows_, 0); |
| 418 | DCHECK_EQ(attached_buffer_bytes_, 0); |
| 419 | |
| 420 | num_rows_ = src->num_rows_; |
| 421 | capacity_ = src->capacity_; |
| 422 | // tuple_ptrs_ were allocated with malloc so can be swapped between batches. |
| 423 | DCHECK(tuple_ptrs_info_.get() == nullptr); |
| 424 | std::swap(tuple_ptrs_, src->tuple_ptrs_); |
| 425 | src->TransferResourceOwnership(this); |
| 426 | } |
| 427 | |
| 428 | void RowBatch::DeepCopyTo(RowBatch* dst) { |
| 429 | DCHECK(dst->row_desc_->Equals(*row_desc_)); |