| 90 | } |
| 91 | |
| 92 | Status PairwiseExec(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 93 | const auto& state = checked_cast<const PairwiseState&>(*ctx->state()); |
| 94 | auto input = batch[0].array; |
| 95 | |
| 96 | // The scalar diff kernel will only write into the non-null output area. |
| 97 | // We must therefore pre-initialize the output, otherwise the left or right |
| 98 | // margin would be left uninitialized. |
| 99 | ARROW_ASSIGN_OR_RAISE(auto builder, |
| 100 | MakeBuilder(out->type()->GetSharedPtr(), ctx->memory_pool())); |
| 101 | // Append nulls rather than empty values, so as to allocate a null bitmap. |
| 102 | RETURN_NOT_OK(builder->AppendNulls(out->length())); |
| 103 | std::shared_ptr<ArrayData> out_data; |
| 104 | RETURN_NOT_OK(builder->FinishInternal(&out_data)); |
| 105 | out_data->null_count = kUnknownNullCount; |
| 106 | out->value = std::move(out_data); |
| 107 | |
| 108 | return PairwiseExecImpl(ctx, batch[0].array, state.scalar_exec, state.periods, |
| 109 | out->array_data_mutable()); |
| 110 | } |
| 111 | |
| 112 | const FunctionDoc pairwise_diff_doc( |
| 113 | "Compute first order difference of an array", |
nothing calls this directly
no test coverage detected