| 57 | : out_type(std::move(out_type)), options(std::move(options_)) {} |
| 58 | |
| 59 | Status Consume(KernelContext*, const ExecSpan& batch) override { |
| 60 | if (batch[0].is_array()) { |
| 61 | const ArraySpan& data = batch[0].array; |
| 62 | this->count += data.length - data.GetNullCount(); |
| 63 | this->nulls_observed = this->nulls_observed || data.GetNullCount(); |
| 64 | |
| 65 | if (!options.skip_nulls && this->nulls_observed) { |
| 66 | // Short-circuit |
| 67 | return Status::OK(); |
| 68 | } |
| 69 | |
| 70 | if (is_boolean_type<ArrowType>::value) { |
| 71 | this->sum += GetTrueCount(data); |
| 72 | } else { |
| 73 | this->sum += SumArray<CType, SumCType, SimdLevel>(data); |
| 74 | } |
| 75 | } else { |
| 76 | const Scalar& data = *batch[0].scalar; |
| 77 | this->count += data.is_valid * batch.length; |
| 78 | this->nulls_observed = this->nulls_observed || !data.is_valid; |
| 79 | if (data.is_valid) { |
| 80 | this->sum += static_cast<SumCType>(internal::UnboxScalar<ArrowType>::Unbox(data) * |
| 81 | batch.length); |
| 82 | } |
| 83 | } |
| 84 | return Status::OK(); |
| 85 | } |
| 86 | |
| 87 | Status MergeFrom(KernelContext*, KernelState&& src) override { |
| 88 | const auto& other = checked_cast<const ThisType&>(src); |
nothing calls this directly
no test coverage detected