MCPcopy Create free account
hub / github.com/apache/arrow / OutputResult

Method OutputResult

cpp/src/arrow/acero/scalar_aggregate_node.cc:290–320  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

288}
289
290Status ScalarAggregateNode::OutputResult(bool is_last) {
291 ExecBatch batch{{}, 1};
292 batch.values.resize(kernels_.size() + segment_field_ids_.size());
293
294 // First, insert segment keys
295 PlaceFields(batch, /*base=*/0, segmenter_values_);
296
297 // Followed by aggregate values
298 std::size_t base = segment_field_ids_.size();
299 for (size_t i = 0; i < kernels_.size(); ++i) {
300 arrow::util::tracing::Span span;
301 START_COMPUTE_SPAN(span, aggs_[i].function,
302 {{"function.name", aggs_[i].function},
303 {"function.options",
304 aggs_[i].options ? aggs_[i].options->ToString() : "<NULLPTR>"},
305 {"function.kind", std::string(kind_name()) + "::Finalize"}});
306 KernelContext ctx{plan()->query_context()->exec_context()};
307 ARROW_ASSIGN_OR_RAISE(auto merged, ScalarAggregateKernel::MergeAll(
308 kernels_[i], &ctx, std::move(states_[i])));
309 RETURN_NOT_OK(kernels_[i]->finalize(&ctx, &batch.values[base + i]));
310 }
311
312 ARROW_RETURN_NOT_OK(output_->InputReceived(this, std::move(batch)));
313 total_output_batches_++;
314 if (is_last) {
315 ARROW_RETURN_NOT_OK(output_->InputFinished(this, total_output_batches_));
316 } else {
317 ARROW_RETURN_NOT_OK(ResetKernelStates());
318 }
319 return Status::OK();
320}
321
322} // namespace aggregate
323} // namespace acero

Callers

nothing calls this directly

Calls 11

PlaceFieldsFunction · 0.85
planFunction · 0.85
resizeMethod · 0.80
exec_contextMethod · 0.80
query_contextMethod · 0.80
finalizeMethod · 0.80
OKFunction · 0.50
sizeMethod · 0.45
ToStringMethod · 0.45
InputReceivedMethod · 0.45
InputFinishedMethod · 0.45

Tested by

no test coverage detected