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

Method AppendScalar

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

Source from the content-addressed store, hash-verified

352 }
353
354 Status AppendScalar(const Scalar& scalar, int64_t n_repeats) override {
355 if (!scalar.is_valid) return AppendNulls(n_repeats);
356
357 const auto& dict_ty = internal::checked_cast<const DictionaryType&>(*scalar.type);
358 const DictionaryScalar& dict_scalar =
359 internal::checked_cast<const DictionaryScalar&>(scalar);
360 const auto& dict = internal::checked_cast<const typename TypeTraits<T>::ArrayType&>(
361 *dict_scalar.value.dictionary);
362 ARROW_RETURN_NOT_OK(Reserve(n_repeats));
363 switch (dict_ty.index_type()->id()) {
364 case Type::UINT8:
365 return AppendScalarImpl<UInt8Type>(dict, *dict_scalar.value.index, n_repeats);
366 case Type::INT8:
367 return AppendScalarImpl<Int8Type>(dict, *dict_scalar.value.index, n_repeats);
368 case Type::UINT16:
369 return AppendScalarImpl<UInt16Type>(dict, *dict_scalar.value.index, n_repeats);
370 case Type::INT16:
371 return AppendScalarImpl<Int16Type>(dict, *dict_scalar.value.index, n_repeats);
372 case Type::UINT32:
373 return AppendScalarImpl<UInt32Type>(dict, *dict_scalar.value.index, n_repeats);
374 case Type::INT32:
375 return AppendScalarImpl<Int32Type>(dict, *dict_scalar.value.index, n_repeats);
376 case Type::UINT64:
377 return AppendScalarImpl<UInt64Type>(dict, *dict_scalar.value.index, n_repeats);
378 case Type::INT64:
379 return AppendScalarImpl<Int64Type>(dict, *dict_scalar.value.index, n_repeats);
380 default:
381 return Status::TypeError("Invalid index type: ", dict_ty);
382 }
383 return Status::OK();
384 }
385
386 Status AppendScalars(const ScalarVector& scalars) override {
387 for (const auto& scalar : scalars) {

Callers

nothing calls this directly

Calls 6

index_typeMethod · 0.80
AppendNullsFunction · 0.70
ReserveFunction · 0.70
TypeErrorFunction · 0.50
OKFunction · 0.50
idMethod · 0.45

Tested by

no test coverage detected