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