| 496 | } |
| 497 | |
| 498 | Status TopNNode::Reset(RuntimeState* state, RowBatch* row_batch) { |
| 499 | if (is_partitioned()) { |
| 500 | partition_heaps_.clear(); |
| 501 | sorter_->Reset(); |
| 502 | sort_out_batch_.reset(); |
| 503 | sort_out_batch_pos_ = 0; |
| 504 | num_rows_returned_from_partition_ = 0; |
| 505 | } else { |
| 506 | heap_->Reset(); |
| 507 | } |
| 508 | tmp_tuple_ = nullptr; |
| 509 | num_rows_skipped_ = 0; |
| 510 | // Transfer ownership of tuple data to output batch. |
| 511 | row_batch->tuple_data_pool()->AcquireData(tuple_pool_.get(), false); |
| 512 | // We deliberately do not free the tuple_pool_ here to allow selective transferring |
| 513 | // of resources in the future. |
| 514 | return ExecNode::Reset(state, row_batch); |
| 515 | } |
| 516 | |
| 517 | void TopNNode::Close(RuntimeState* state) { |
| 518 | if (is_closed()) return; |
no test coverage detected