ZhangHuiGui commented on code in PR #41295:
URL: https://github.com/apache/arrow/pull/41295#discussion_r1571986546
##########
cpp/src/arrow/compute/kernels/scalar_nested.cc:
##########
@@ -39,12 +39,26 @@ namespace {
template <typename Type, typename offset_type = typename Type::offset_type>
Status ListValueLength(KernelContext* ctx, const ExecSpan& batch, ExecResult*
out) {
const ArraySpan& arr = batch[0].array;
+ const auto kind = arr.type->id();
ArraySpan* out_arr = out->array_span_mutable();
auto out_values = out_arr->GetValues<offset_type>(1);
- const offset_type* offsets = arr.GetValues<offset_type>(1);
- // Offsets are always well-defined and monotonic, even for null values
- for (int64_t i = 0; i < arr.length; ++i) {
- *out_values++ = offsets[i + 1] - offsets[i];
+ if (is_list_view(kind)) {
Review Comment:
agree, `kind` is only used once.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]