| 178 | } // namespace |
| 179 | |
| 180 | void RegisterVectorStatistics(FunctionRegistry* registry) { |
| 181 | static const auto default_winsorize_options = WinsorizeOptions(); |
| 182 | |
| 183 | auto winsorize = std::make_shared<VectorFunction>( |
| 184 | "winsorize", Arity::Unary(), winsorize_doc, &default_winsorize_options); |
| 185 | |
| 186 | VectorKernel base; |
| 187 | base.init = WinsorizeState::Init; |
| 188 | base.mem_allocation = MemAllocation::NO_PREALLOCATE; |
| 189 | base.null_handling = NullHandling::COMPUTED_NO_PREALLOCATE; |
| 190 | base.can_execute_chunkwise = false; |
| 191 | // The variable is ill-named, but since we output a ChunkedArray ourselves, |
| 192 | // the function execution logic shouldn't try to wrap it again. |
| 193 | base.output_chunked = false; |
| 194 | |
| 195 | for (const auto& ty : NumericTypes()) { |
| 196 | base.signature = KernelSignature::Make({ty->id()}, &ResolveWinsorizeOutput); |
| 197 | base.exec = GenerateNumeric<Winsorize, /*Unused*/ void>(ty->id()); |
| 198 | base.exec_chunked = GenerateNumeric<WinsorizeChunked, /*Unused*/ void>(ty->id()); |
| 199 | DCHECK_OK(winsorize->AddKernel(base)); |
| 200 | } |
| 201 | for (auto type_id : DecimalTypeIds()) { |
| 202 | base.signature = KernelSignature::Make({type_id}, &ResolveWinsorizeOutput); |
| 203 | base.exec = GenerateDecimal<Winsorize, /*Unused*/ void>(type_id); |
| 204 | base.exec_chunked = GenerateDecimal<WinsorizeChunked, /*Unused*/ void>(type_id); |
| 205 | DCHECK_OK(winsorize->AddKernel(base)); |
| 206 | } |
| 207 | DCHECK_OK(registry->AddFunction(std::move(winsorize))); |
| 208 | } |
| 209 | |
| 210 | } // namespace arrow::compute::internal |
no test coverage detected