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

Method addInput

bolt/exec/HashAggregation.cpp:267–353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

265}
266
267void HashAggregation::addInput(RowVectorPtr input) {
268 if (!pushdownChecked_) {
269 mayPushdown_ = operatorCtx_->driver()->mayPushdownAggregation(this);
270 pushdownChecked_ = true;
271 }
272 if (abandonedPartialAggregation_) {
273 input_ = input;
274 numInputRows_ += input->size();
275 addRuntimeStat("abandonedVectors", RuntimeCounter(1));
276 addRuntimeStat("abandonedRows", RuntimeCounter(input_->size()));
277 return;
278 }
279 if (!isPartialStep_ && acceptCompositeVectorInput_) {
280 CompositeRowVectorPtr compositeInput =
281 std::dynamic_pointer_cast<CompositeRowVector>(input);
282 if (compositeInput) {
283 if (convertedInput_) {
284 VectorPtr converted = std::move(convertedInput_);
285 BaseVector::prepareForReuse(converted, input->size());
286 convertedInput_ = std::static_pointer_cast<RowVector>(converted);
287 } else {
288 convertedInput_ =
289 BaseVector::create<RowVector>(input->type(), input->size(), pool());
290 }
291 groupingSet_->convertCompositeInput(
292 aggregatesForExtractColumns_, compositeInput, convertedInput_);
293 input = convertedInput_;
294 }
295 }
296 // Reset tracking between batches to prevent memory buildup
297 groupingSet_->resetDistinctNewGroups();
298 if (input->size() > maxInputBatchCount_) {
299 if (isLazyNotLoaded(*input)) {
300 input->loadedVector();
301 }
302 for (int64_t i = 0; i < input->size(); i += maxInputBatchCount_) {
303 auto length = std::min(input->size() - i, maxInputBatchCount_);
304 auto inputSlice =
305 std::dynamic_pointer_cast<RowVector>(input->slice(i, length));
306 groupingSet_->addInput(inputSlice, mayPushdown_);
307
308 if (isDistinct_) {
309 // Only adjust indices for distinct case needing cross-batch tracking
310 groupingSet_->putDistinctNewGroupsIndices(i);
311 }
312 }
313 } else {
314 groupingSet_->addInput(input, mayPushdown_);
315 if (isDistinct_) {
316 // Only adjust indices for distinct case needing cross-batch tracking
317 groupingSet_->putDistinctNewGroupsIndices(0);
318 }
319 }
320 numInputRows_ += input->size();
321
322 updateRuntimeStats();
323
324 // NOTE: we should not trigger partial output flush in case of global

Callers

nothing calls this directly

Calls 15

RuntimeCounterClass · 0.85
isLazyNotLoadedFunction · 0.85
driverMethod · 0.80
convertCompositeInputMethod · 0.80
isPartialFullMethod · 0.80
poolFunction · 0.50
minFunction · 0.50
sizeMethod · 0.45
typeMethod · 0.45

Tested by

no test coverage detected