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

Function CopyValues

cpp/src/arrow/compute/kernels/scalar_if_else.cc:1372–1402  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1370// Copy fixed-width values from a scalar/array into an output values buffer
1371template <typename Type>
1372void CopyValues(const ExecValue& in_values, const int64_t in_offset, const int64_t length,
1373 uint8_t* out_valid, uint8_t* out_values, const int64_t out_offset) {
1374 if (in_values.is_scalar()) {
1375 const Scalar& scalar = *in_values.scalar;
1376 if (out_valid) {
1377 bit_util::SetBitsTo(out_valid, out_offset, length, scalar.is_valid);
1378 }
1379 CopyDataUtils<Type>::CopyData(*scalar.type, scalar, /*in_offset=*/0, out_values,
1380 out_offset, length);
1381 } else {
1382 const ArraySpan& array = in_values.array;
1383 if (out_valid) {
1384 if (array.MayHaveNulls()) {
1385 if (length == 1) {
1386 // CopyBitmap is slow for short runs
1387 bit_util::SetBitTo(
1388 out_valid, out_offset,
1389 bit_util::GetBit(array.buffers[0].data, array.offset + in_offset));
1390 } else {
1391 arrow::internal::CopyBitmap(array.buffers[0].data, array.offset + in_offset,
1392 length, out_valid, out_offset);
1393 }
1394 } else {
1395 bit_util::SetBitsTo(out_valid, out_offset, length, true);
1396 }
1397 }
1398 CopyDataUtils<Type>::CopyData(*array.type, array.buffers[1].data,
1399 array.offset + in_offset, out_values, out_offset,
1400 length);
1401 }
1402}
1403
1404// Specialized helper to copy a single value from a source array. Allows avoiding
1405// repeatedly calling MayHaveNulls and Buffer::data() which have internal checks that

Callers 4

CopyValuesMethod · 0.85
CopyValuesMethod · 0.85
CopyValuesMethod · 0.85
CopyFixedWidthValuesMethod · 0.85

Calls 5

is_scalarMethod · 0.80
SetBitsToFunction · 0.50
SetBitToFunction · 0.50
GetBitFunction · 0.50
CopyBitmapFunction · 0.50

Tested by

no test coverage detected