| 1188 | } // namespace |
| 1189 | |
| 1190 | Status PropagateNulls(KernelContext* ctx, const ExecSpan& batch, ArrayData* output) { |
| 1191 | DCHECK_NE(nullptr, output); |
| 1192 | DCHECK_GT(output->buffers.size(), 0); |
| 1193 | |
| 1194 | if (output->type->id() == Type::NA) { |
| 1195 | // Null output type is a no-op (rare when this would happen but we at least |
| 1196 | // will test for it) |
| 1197 | return Status::OK(); |
| 1198 | } |
| 1199 | |
| 1200 | // This function is ONLY able to write into output with non-zero offset |
| 1201 | // when the bitmap is preallocated. This could be a DCHECK but returning |
| 1202 | // error Status for now for emphasis |
| 1203 | if (output->offset != 0 && output->buffers[0] == nullptr) { |
| 1204 | return Status::Invalid( |
| 1205 | "Can only propagate nulls into pre-allocated memory " |
| 1206 | "when the output offset is non-zero"); |
| 1207 | } |
| 1208 | NullPropagator propagator(ctx, batch, output); |
| 1209 | return propagator.Execute(); |
| 1210 | } |
| 1211 | |
| 1212 | void PropagateNullsSpans(const ExecSpan& batch, ArraySpan* out) { |
| 1213 | if (out->type->id() == Type::NA) { |