| 1033 | } |
| 1034 | |
| 1035 | void GroupingAggregator::ClosePartitions() { |
| 1036 | // Iterate through the remaining rows in the hash table and call Serialize/Finalize on |
| 1037 | // them in order to free any memory allocated by UDAs |
| 1038 | if (output_partition_ != nullptr) { |
| 1039 | CleanupHashTbl(output_partition_->agg_fn_evals, output_iterator_); |
| 1040 | output_partition_->Close(false); |
| 1041 | output_partition_ = nullptr; |
| 1042 | output_iterator_.SetAtEnd(); |
| 1043 | } |
| 1044 | for (Partition* partition : hash_partitions_) { |
| 1045 | if (partition != nullptr) partition->Close(true); |
| 1046 | } |
| 1047 | hash_partitions_.clear(); |
| 1048 | for (Partition* partition : aggregated_partitions_) partition->Close(true); |
| 1049 | aggregated_partitions_.clear(); |
| 1050 | for (Partition* partition : spilled_partitions_) partition->Close(true); |
| 1051 | spilled_partitions_.clear(); |
| 1052 | memset(hash_tbls_, 0, sizeof(hash_tbls_)); |
| 1053 | partition_pool_->Clear(); |
| 1054 | } |
| 1055 | |
| 1056 | int64_t GroupingAggregator::MinReservation() const { |
| 1057 | // Must be kept in sync with AggregationNode.computeNodeResourceProfile() in fe. |