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

Method FillBuffer

cpp/src/arrow/compute/kernels/aggregate_quantile.cc:155–177  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

153
154 template <typename Container>
155 void FillBuffer(const QuantileOptions& options, const Container& container,
156 int64_t length, int64_t null_count,
157 std::vector<CType, Allocator>* in_buffer) {
158 int64_t in_length = 0;
159 if ((!options.skip_nulls && null_count > 0) ||
160 (length - null_count < options.min_count)) {
161 in_length = 0;
162 } else {
163 in_length = length - null_count;
164 }
165
166 if (in_length > 0) {
167 in_buffer->resize(in_length);
168 CopyNonNullValues(container, in_buffer->data());
169
170 // drop nan
171 if (is_floating_type<InType>::value) {
172 const auto& it = std::remove_if(in_buffer->begin(), in_buffer->end(),
173 [](CType v) { return v != v; });
174 in_buffer->resize(it - in_buffer->begin());
175 }
176 }
177 }
178
179 Status Exec(KernelContext* ctx, const ArraySpan& values, ExecResult* out) {
180 const QuantileOptions& options = QuantileState::Get(ctx);

Callers

nothing calls this directly

Calls 5

CopyNonNullValuesFunction · 0.85
resizeMethod · 0.80
dataMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected