| 249 | } |
| 250 | |
| 251 | void 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 | |
| 294 | bool StreamingAggregation::isFinished() { |
| 295 | return noMoreInput_ && input_ == nullptr && numGroups_ == 0; |
nothing calls this directly
no test coverage detected