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

Method evaluateAggregates

bolt/exec/StreamingAggregation.cpp:251–292  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

249}
250
251void StreamingAggregation::evaluateAggregates() {
252 NanosecondTimer funcTimer(&stats_.aggFunctionTimeNs);
253 for (auto i = 0; i < aggregates_.size(); ++i) {
254 const auto& aggregate = aggregates_.at(i);
255 if (!aggregate.sortingKeys.empty()) {
256 continue;
257 }
258
259 const auto& rows = getSelectivityVector(i);
260 if (!rows.hasSelections()) {
261 continue;
262 }
263
264 if (aggregate.distinct) {
265 distinctAggregations_.at(i)->addInput(inputGroups_.data(), input_, rows);
266 continue;
267 }
268
269 const auto& function = aggregate.function;
270 const auto& inputs = aggregate.inputs;
271 const auto& constantInputs = aggregate.constantInputs;
272
273 std::vector<VectorPtr> args;
274 for (auto j = 0; j < inputs.size(); ++j) {
275 if (inputs[j] == kConstantChannel) {
276 args.push_back(constantInputs[j]);
277 } else {
278 args.push_back(input_->childAt(inputs[j]));
279 }
280 }
281
282 if (isRawInput(step_)) {
283 function->addRawInput(inputGroups_.data(), rows, args, false);
284 } else {
285 function->addIntermediateResults(inputGroups_.data(), rows, args, false);
286 }
287 }
288
289 if (sortedAggregations_) {
290 sortedAggregations_->addInput(inputGroups_.data(), input_);
291 }
292}
293
294bool StreamingAggregation::isFinished() {
295 return noMoreInput_ && input_ == nullptr && numGroups_ == 0;

Callers

nothing calls this directly

Calls 11

isRawInputFunction · 0.85
hasSelectionsMethod · 0.80
childAtMethod · 0.80
sizeMethod · 0.45
atMethod · 0.45
emptyMethod · 0.45
addInputMethod · 0.45
dataMethod · 0.45
push_backMethod · 0.45
addRawInputMethod · 0.45

Tested by

no test coverage detected