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

Function PairwiseExec

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

Source from the content-addressed store, hash-verified

90}
91
92Status 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
112const FunctionDoc pairwise_diff_doc(
113 "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