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

Method Finalize

cpp/src/arrow/compute/kernels/aggregate_basic.inc.cc:834–853  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

832 }
833
834 Status Finalize(KernelContext*, Datum* out) override {
835 const auto& struct_type = checked_cast<const StructType&>(*out_type);
836 const auto& child_type = struct_type.field(0)->type();
837
838 std::vector<std::shared_ptr<Scalar>> values;
839 // Physical type != result type
840 if ((state.has_nulls && !options.skip_nulls) || (this->count < options.min_count)) {
841 // (null, null)
842 auto null_scalar = MakeNullScalar(child_type);
843 values = {null_scalar, null_scalar};
844 } else {
845 ARROW_ASSIGN_OR_RAISE(auto min_scalar,
846 MakeScalar(child_type, std::move(state.min)));
847 ARROW_ASSIGN_OR_RAISE(auto max_scalar,
848 MakeScalar(child_type, std::move(state.max)));
849 values = {std::move(min_scalar), std::move(max_scalar)};
850 }
851 out->value = std::make_shared<StructScalar>(std::move(values), this->out_type);
852 return Status::OK();
853 }
854
855 std::shared_ptr<DataType> out_type;
856 ScalarAggregateOptions options;

Callers

nothing calls this directly

Calls 4

MakeNullScalarFunction · 0.85
OKFunction · 0.50
typeMethod · 0.45
fieldMethod · 0.45

Tested by

no test coverage detected