| 143 | } |
| 144 | |
| 145 | void HashAggregateSharedState::finalizePartitions() { |
| 146 | BaseAggregateSharedState::finalizePartitions(globalPartitions, [&](auto& partition) { |
| 147 | if (!partition.hashTable) { |
| 148 | // We always initialize the hash table in the first partition |
| 149 | partition.hashTable = std::make_unique<AggregateHashTable>( |
| 150 | globalPartitions[0].hashTable->createEmptyCopy()); |
| 151 | } |
| 152 | // TODO(bmwinger): ideally these can be merged into a single function. |
| 153 | // The distinct tables need to be merged first so that they exist when the other table |
| 154 | // updates the agg states when it merges |
| 155 | for (size_t i = 0; i < partition.distinctTableQueues.size(); i++) { |
| 156 | if (partition.distinctTableQueues[i]) { |
| 157 | partition.distinctTableQueues[i]->mergeInto( |
| 158 | *partition.hashTable->getDistinctHashTable(i)); |
| 159 | } |
| 160 | } |
| 161 | partition.queue->mergeInto(*partition.hashTable); |
| 162 | partition.hashTable->mergeDistinctAggregateInfo(); |
| 163 | |
| 164 | partition.hashTable->finalizeAggregateStates(); |
| 165 | }); |
| 166 | } |
| 167 | |
| 168 | std::tuple<const FactorizedTable*, offset_t> HashAggregateSharedState::getPartitionForOffset( |
| 169 | offset_t offset) const { |
nothing calls this directly
no test coverage detected