| 33 | } |
| 34 | |
| 35 | void UnionNode::MaterializeBatch(RowBatch* dst_batch, uint8_t** tuple_buf) { |
| 36 | // Take all references to member variables out of the loop to reduce the number of |
| 37 | // loads and stores. |
| 38 | RowBatch* child_batch = child_batch_.get(); |
| 39 | int tuple_byte_size = tuple_desc_->byte_size(); |
| 40 | uint8_t* cur_tuple = *tuple_buf; |
| 41 | const std::vector<ScalarExprEvaluator*>& child_expr_evals = |
| 42 | child_expr_evals_lists_[child_idx_]; |
| 43 | |
| 44 | int num_rows_to_process = std::min(child_batch->num_rows() - child_row_idx_, |
| 45 | dst_batch->capacity() - dst_batch->num_rows()); |
| 46 | FOREACH_ROW_LIMIT(child_batch, child_row_idx_, num_rows_to_process, batch_iter) { |
| 47 | TupleRow* child_row = batch_iter.Get(); |
| 48 | MaterializeExprs(child_expr_evals, child_row, cur_tuple, dst_batch); |
| 49 | cur_tuple += tuple_byte_size; |
| 50 | } |
| 51 | |
| 52 | child_row_idx_ += num_rows_to_process; |
| 53 | *tuple_buf = cur_tuple; |
| 54 | } |