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

Method AppendArraySlice

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

Source from the content-addressed store, hash-verified

391 }
392
393 Status AppendArraySlice(const ArraySpan& array, int64_t offset, int64_t length) final {
394 // Visit the indices and insert the unpacked values.
395 const auto& dict_ty = internal::checked_cast<const DictionaryType&>(*array.type);
396 // See if possible to avoid using ToArrayData here
397 const typename TypeTraits<T>::ArrayType dict(array.dictionary().ToArrayData());
398 ARROW_RETURN_NOT_OK(Reserve(length));
399 switch (dict_ty.index_type()->id()) {
400 case Type::UINT8:
401 return AppendArraySliceImpl<uint8_t>(dict, array, offset, length);
402 case Type::INT8:
403 return AppendArraySliceImpl<int8_t>(dict, array, offset, length);
404 case Type::UINT16:
405 return AppendArraySliceImpl<uint16_t>(dict, array, offset, length);
406 case Type::INT16:
407 return AppendArraySliceImpl<int16_t>(dict, array, offset, length);
408 case Type::UINT32:
409 return AppendArraySliceImpl<uint32_t>(dict, array, offset, length);
410 case Type::INT32:
411 return AppendArraySliceImpl<int32_t>(dict, array, offset, length);
412 case Type::UINT64:
413 return AppendArraySliceImpl<uint64_t>(dict, array, offset, length);
414 case Type::INT64:
415 return AppendArraySliceImpl<int64_t>(dict, array, offset, length);
416 default:
417 return Status::TypeError("Invalid index type: ", dict_ty);
418 }
419 return Status::OK();
420 }
421
422 /// \brief Insert values into the dictionary's memo, but do not append any
423 /// 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