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

Method AppendArraySlice

cpp/src/arrow/array/builder_dict.h:374–401  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

372 }
373
374 Status AppendArraySlice(const ArraySpan& array, int64_t offset, int64_t length) final {
375 // Visit the indices and insert the unpacked values.
376 const auto& dict_ty = internal::checked_cast<const DictionaryType&>(*array.type);
377 // See if possible to avoid using ToArrayData here
378 const typename TypeTraits<T>::ArrayType dict(array.dictionary().ToArrayData());
379 ARROW_RETURN_NOT_OK(Reserve(length));
380 switch (dict_ty.index_type()->id()) {
381 case Type::UINT8:
382 return AppendArraySliceImpl<uint8_t>(dict, array, offset, length);
383 case Type::INT8:
384 return AppendArraySliceImpl<int8_t>(dict, array, offset, length);
385 case Type::UINT16:
386 return AppendArraySliceImpl<uint16_t>(dict, array, offset, length);
387 case Type::INT16:
388 return AppendArraySliceImpl<int16_t>(dict, array, offset, length);
389 case Type::UINT32:
390 return AppendArraySliceImpl<uint32_t>(dict, array, offset, length);
391 case Type::INT32:
392 return AppendArraySliceImpl<int32_t>(dict, array, offset, length);
393 case Type::UINT64:
394 return AppendArraySliceImpl<uint64_t>(dict, array, offset, length);
395 case Type::INT64:
396 return AppendArraySliceImpl<int64_t>(dict, array, offset, length);
397 default:
398 return Status::TypeError("Invalid index type: ", dict_ty);
399 }
400 return Status::OK();
401 }
402
403 /// \brief Insert values into the dictionary's memo, but do not append any
404 /// indices. Can be used to initialize a new builder with known dictionary

Callers

nothing calls this directly

Calls 7

ToArrayDataMethod · 0.80
index_typeMethod · 0.80
ReserveFunction · 0.70
TypeErrorFunction · 0.50
OKFunction · 0.50
dictionaryMethod · 0.45
idMethod · 0.45

Tested by

no test coverage detected