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

Method BuildArray

cpp/src/arrow/compute/kernels/scalar_nested.cc:244–263  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

242 /// \brief Builds the array of list slices from the input list array
243 template <typename BuilderType>
244 static Status BuildArray(MemoryPool* pool, const ListSliceOptions& opts,
245 const ExecSpan& batch,
246 const std::shared_ptr<DataType>& output_type,
247 ExecResult* out) {
248 std::unique_ptr<ArrayBuilder> builder;
249 RETURN_NOT_OK(MakeBuilder(pool, output_type, &builder));
250 auto* list_builder = checked_cast<BuilderType*>(builder.get());
251 RETURN_NOT_OK(list_builder->Resize(batch[0].array.length));
252 if constexpr (std::is_same_v<InListType, FixedSizeListType>) {
253 RETURN_NOT_OK(BuildArrayFromFixedSizeListType(opts.start, opts.step, opts.stop,
254 batch, list_builder));
255 } else {
256 RETURN_NOT_OK(BuildArrayFromVarLenListLikeType(opts.start, opts.step, opts.stop,
257 batch, list_builder));
258 }
259 std::shared_ptr<ArrayData> result;
260 RETURN_NOT_OK(list_builder->FinishInternal(&result));
261 out->value = std::move(result);
262 return Status::OK();
263 }
264
265 template <typename BuilderType>
266 static Status BuildArrayFromFixedSizeListType(int64_t start, int64_t step,

Callers

nothing calls this directly

Calls 5

MakeBuilderFunction · 0.50
OKFunction · 0.50
getMethod · 0.45
ResizeMethod · 0.45
FinishInternalMethod · 0.45

Tested by

no test coverage detected