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