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

Method Finalize

cpp/src/arrow/compute/kernels/hash_aggregate.cc:401–419  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

399 }
400
401 Result<Datum> Finalize() override {
402 // aggregation for group is valid if there was at least one value in that group
403 ARROW_ASSIGN_OR_RAISE(auto null_bitmap, has_values_.Finish());
404
405 if (!options_.skip_nulls) {
406 // ... and there were no nulls in that group
407 ARROW_ASSIGN_OR_RAISE(auto has_nulls, has_nulls_.Finish());
408 arrow::internal::BitmapAndNot(null_bitmap->data(), 0, has_nulls->data(), 0,
409 num_groups_, 0, null_bitmap->mutable_data());
410 }
411
412 auto mins = ArrayData::Make(type_, num_groups_, {null_bitmap, nullptr});
413 auto maxes = ArrayData::Make(type_, num_groups_, {std::move(null_bitmap), nullptr});
414 ARROW_ASSIGN_OR_RAISE(mins->buffers[1], mins_.Finish());
415 ARROW_ASSIGN_OR_RAISE(maxes->buffers[1], maxes_.Finish());
416
417 return ArrayData::Make(out_type(), num_groups_, {nullptr},
418 {std::move(mins), std::move(maxes)});
419 }
420
421 std::shared_ptr<DataType> out_type() const override {
422 return struct_({field("min", type_), field("max", type_)});

Callers

nothing calls this directly

Calls 7

BitmapAndNotFunction · 0.85
out_typeFunction · 0.85
MakeFunction · 0.50
ARROW_ASSIGN_OR_RAISEFunction · 0.50
dataMethod · 0.45
mutable_dataMethod · 0.45
FinishMethod · 0.45

Tested by

no test coverage detected