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

Method AppendScalar

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

Source from the content-addressed store, hash-verified

341 }
342
343 Status AppendScalar(const Scalar& scalar, int64_t n_repeats) override {
344 if (!scalar.is_valid) return AppendNulls(n_repeats);
345
346 const auto& dict_ty = internal::checked_cast<const DictionaryType&>(*scalar.type);
347 const DictionaryScalar& dict_scalar =
348 internal::checked_cast<const DictionaryScalar&>(scalar);
349 const auto& dict = internal::checked_cast<const typename TypeTraits<T>::ArrayType&>(
350 *dict_scalar.value.dictionary);
351 ARROW_RETURN_NOT_OK(Reserve(n_repeats));
352 switch (dict_ty.index_type()->id()) {
353 case Type::UINT8:
354 return AppendScalarImpl<UInt8Type>(dict, *dict_scalar.value.index, n_repeats);
355 case Type::INT8:
356 return AppendScalarImpl<Int8Type>(dict, *dict_scalar.value.index, n_repeats);
357 case Type::UINT16:
358 return AppendScalarImpl<UInt16Type>(dict, *dict_scalar.value.index, n_repeats);
359 case Type::INT16:
360 return AppendScalarImpl<Int16Type>(dict, *dict_scalar.value.index, n_repeats);
361 case Type::UINT32:
362 return AppendScalarImpl<UInt32Type>(dict, *dict_scalar.value.index, n_repeats);
363 case Type::INT32:
364 return AppendScalarImpl<Int32Type>(dict, *dict_scalar.value.index, n_repeats);
365 case Type::UINT64:
366 return AppendScalarImpl<UInt64Type>(dict, *dict_scalar.value.index, n_repeats);
367 case Type::INT64:
368 return AppendScalarImpl<Int64Type>(dict, *dict_scalar.value.index, n_repeats);
369 default:
370 return Status::TypeError("Invalid index type: ", dict_ty);
371 }
372 return Status::OK();
373 }
374
375 Status AppendScalars(const ScalarVector& scalars) override {
376 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