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

Method MakeUnionArray

cpp/src/arrow/array/builder_base.cc:240–259  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

238
239 template <typename T>
240 Status MakeUnionArray(const T& type) {
241 using BuilderType = typename TypeTraits<T>::BuilderType;
242
243 auto* builder = checked_cast<BuilderType*>(builder_);
244 const auto count = n_repeats_ * (scalars_end_ - scalars_begin_);
245
246 RETURN_NOT_OK(builder->Reserve(count));
247
248 DCHECK_EQ(type.num_fields(), builder->num_children());
249 for (int field_index = 0; field_index < type.num_fields(); ++field_index) {
250 RETURN_NOT_OK(builder->child_builder(field_index)->Reserve(count));
251 }
252
253 for (int64_t i = 0; i < n_repeats_; i++) {
254 for (auto it = scalars_begin_; it != scalars_end_; ++it) {
255 RETURN_NOT_OK(AppendUnionScalar(type, *it, builder));
256 }
257 }
258 return Status::OK();
259 }
260
261 Status Visit(const RunEndEncodedType&) {
262 auto builder = checked_cast<RunEndEncodedBuilder*>(builder_);

Callers

nothing calls this directly

Calls 3

OKFunction · 0.50
ReserveMethod · 0.45
num_fieldsMethod · 0.45

Tested by

no test coverage detected