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

Method Finalize

cpp/src/arrow/compute/kernels/aggregate_var_std.cc:200–226  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

198 }
199
200 Status Finalize(KernelContext*, Datum* out) override {
201 if (state.count() <= ddof || state.count() < min_count ||
202 (!state.all_valid && !skip_nulls) ||
203 (stat_type == StatisticType::Skew && !biased && state.count() < 3) ||
204 (stat_type == StatisticType::Kurtosis && !biased && state.count() < 4)) {
205 out->value = std::make_shared<DoubleScalar>();
206 } else {
207 switch (stat_type) {
208 case StatisticType::Std:
209 out->value = std::make_shared<DoubleScalar>(state.moments.Stddev(ddof));
210 break;
211 case StatisticType::Var:
212 out->value = std::make_shared<DoubleScalar>(state.moments.Variance(ddof));
213 break;
214 case StatisticType::Skew:
215 out->value = std::make_shared<DoubleScalar>(state.moments.Skew(biased));
216 break;
217 case StatisticType::Kurtosis:
218 out->value = std::make_shared<DoubleScalar>(state.moments.Kurtosis(biased));
219 break;
220 default:
221 return Status::NotImplemented("Unsupported statistic type ",
222 static_cast<int>(stat_type));
223 }
224 }
225 return Status::OK();
226 }
227
228 std::shared_ptr<DataType> out_type;
229 StatisticType stat_type;

Callers

nothing calls this directly

Calls 7

StddevMethod · 0.80
VarianceMethod · 0.80
SkewMethod · 0.80
KurtosisMethod · 0.80
NotImplementedFunction · 0.50
OKFunction · 0.50
countMethod · 0.45

Tested by

no test coverage detected