MCPcopy Create free account
hub / github.com/bytedance/bolt / createOutput

Method createOutput

bolt/exec/StreamingAggregation.cpp:161–202  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

159}
160
161RowVectorPtr StreamingAggregation::createOutput(size_t numGroups) {
162 NanosecondTimer timer(&stats_.aggExtractGroupsTimeNs);
163 auto output = BaseVector::create<RowVector>(outputType_, numGroups, pool());
164
165 for (auto i = 0; i < groupingKeys_.size(); ++i) {
166 rows_->extractColumn(groups_.data(), numGroups, i, output->childAt(i));
167 }
168
169 auto numKeys = groupingKeys_.size();
170 for (auto i = 0; i < aggregates_.size(); ++i) {
171 const auto& aggregate = aggregates_.at(i);
172 if (!aggregate.sortingKeys.empty()) {
173 continue;
174 }
175
176 if (aggregate.distinct) {
177 continue;
178 }
179
180 const auto& function = aggregate.function;
181 auto& result = output->childAt(numKeys + i);
182 if (isPartialOutput(step_)) {
183 function->extractAccumulators(groups_.data(), numGroups, &result);
184 } else {
185 function->extractValues(groups_.data(), numGroups, &result);
186 }
187 }
188
189 if (sortedAggregations_) {
190 sortedAggregations_->extractValues(
191 folly::Range<char**>(groups_.data(), numGroups), output);
192 }
193
194 for (const auto& aggregation : distinctAggregations_) {
195 if (aggregation != nullptr) {
196 aggregation->extractValues(
197 folly::Range<char**>(groups_.data(), numGroups), output);
198 }
199 }
200
201 return output;
202}
203
204void StreamingAggregation::assignGroups() {
205 auto numInput = input_->size();

Callers

nothing calls this directly

Calls 10

isPartialOutputFunction · 0.85
childAtMethod · 0.80
poolFunction · 0.50
sizeMethod · 0.45
extractColumnMethod · 0.45
dataMethod · 0.45
atMethod · 0.45
emptyMethod · 0.45
extractAccumulatorsMethod · 0.45
extractValuesMethod · 0.45

Tested by

no test coverage detected