MCPcopy Create free account
hub / github.com/apache/arrow / PairwiseExec

Function PairwiseExec

cpp/src/arrow/compute/kernels/vector_pairwise.cc:94–112  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 5

PairwiseExecImplFunction · 0.85
stateMethod · 0.45
AppendNullsMethod · 0.45
lengthMethod · 0.45
FinishInternalMethod · 0.45

Tested by

no test coverage detected