MCPcopy Create free account
hub / github.com/LadybugDB/ladybug / finalizePartitions

Method finalizePartitions

src/processor/operator/aggregate/hash_aggregate.cpp:145–166  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

143}
144
145void 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
168std::tuple<const FactorizedTable*, offset_t> HashAggregateSharedState::getPartitionForOffset(
169 offset_t offset) const {

Callers

nothing calls this directly

Calls 6

createEmptyCopyMethod · 0.80
mergeIntoMethod · 0.80
getDistinctHashTableMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected