| 42 | |
| 43 | template <typename Type, typename offset_type = typename Type::offset_type> |
| 44 | Status ListValueLength(KernelContext* ctx, const ExecSpan& batch, ExecResult* out) { |
| 45 | const ArraySpan& arr = batch[0].array; |
| 46 | ArraySpan* out_arr = out->array_span_mutable(); |
| 47 | auto out_values = out_arr->GetValues<offset_type>(1); |
| 48 | if (is_list_view(*arr.type)) { |
| 49 | const auto* sizes = arr.GetValues<offset_type>(2); |
| 50 | if (arr.length > 0) { |
| 51 | memcpy(out_values, sizes, arr.length * sizeof(offset_type)); |
| 52 | } |
| 53 | } else { |
| 54 | const offset_type* offsets = arr.GetValues<offset_type>(1); |
| 55 | // Offsets are always well-defined and monotonic, even for null values |
| 56 | for (int64_t i = 0; i < arr.length; ++i) { |
| 57 | *out_values++ = offsets[i + 1] - offsets[i]; |
| 58 | } |
| 59 | } |
| 60 | return Status::OK(); |
| 61 | } |
| 62 | |
| 63 | Status FixedSizeListValueLength(KernelContext* ctx, const ExecSpan& batch, |
| 64 | ExecResult* out) { |
nothing calls this directly
no test coverage detected