| 78 | } |
| 79 | |
| 80 | static Status ExecChunked(KernelContext* ctx, const ExecBatch& batch, Datum* out) { |
| 81 | const auto& options = WinsorizeState::Get(ctx); |
| 82 | RETURN_NOT_OK(ValidateOptions(options)); |
| 83 | const auto& chunked_array = batch.values[0].chunked_array(); |
| 84 | ARROW_ASSIGN_OR_RAISE(auto maybe_quantiles, |
| 85 | GetQuantileValues(ctx, chunked_array, options)); |
| 86 | if (!maybe_quantiles.has_value()) { |
| 87 | // Only nulls and NaNs => return input as-is |
| 88 | *out = chunked_array; |
| 89 | return Status::OK(); |
| 90 | } |
| 91 | ArrayVector out_chunks; |
| 92 | out_chunks.reserve(chunked_array->num_chunks()); |
| 93 | for (const auto& chunk : chunked_array->chunks()) { |
| 94 | auto out_data = chunk->data()->Copy(); |
| 95 | RETURN_NOT_OK( |
| 96 | ClipValues(*chunk->data(), maybe_quantiles.value(), out_data.get(), ctx)); |
| 97 | out_chunks.push_back(MakeArray(out_data)); |
| 98 | } |
| 99 | return ChunkedArray::Make(std::move(out_chunks)).Value(out); |
| 100 | } |
| 101 | |
| 102 | struct QuantileValues { |
| 103 | CType lower_bound, upper_bound; |
nothing calls this directly
no test coverage detected