felipecrv commented on code in PR #35345:
URL: https://github.com/apache/arrow/pull/35345#discussion_r1338990483


##########
cpp/src/arrow/array/concatenate.cc:
##########
@@ -248,6 +305,38 @@ class ConcatenateImpl {
     return ConcatenateImpl(child_data, 
pool_).Concatenate(&out_->child_data[0]);
   }
 
+  template <typename T>
+  enable_if_list_view<T, Status> Visit(const T& type) {
+    using offset_type = typename T::offset_type;
+    out_->buffers.resize(3);
+    out_->child_data.resize(1);
+
+    // Calculate the ranges of values that each list-view array uses
+    std::vector<Range> value_ranges;
+    value_ranges.reserve(in_.size());
+    for (const auto& input : in_) {
+      ArraySpan input_span(*input);
+      Range range;
+      ARROW_ASSIGN_OR_RAISE(std::tie(range.offset, range.length),
+                            
list_util::internal::RangeOfValuesUsed(input_span));
+      value_ranges.push_back(range);

Review Comment:
   I don't mind the explicitness of `std::tie(range.offset, range.length)` as 
pairs (which I use a lot) have the problem that you need to understand the 
context to be sure about the meaning of the `.second` field — is it a length or 
the inclusive offset bound.



##########
cpp/src/arrow/array/concatenate.cc:
##########
@@ -248,6 +305,38 @@ class ConcatenateImpl {
     return ConcatenateImpl(child_data, 
pool_).Concatenate(&out_->child_data[0]);
   }
 
+  template <typename T>
+  enable_if_list_view<T, Status> Visit(const T& type) {
+    using offset_type = typename T::offset_type;
+    out_->buffers.resize(3);
+    out_->child_data.resize(1);
+
+    // Calculate the ranges of values that each list-view array uses
+    std::vector<Range> value_ranges;
+    value_ranges.reserve(in_.size());
+    for (const auto& input : in_) {
+      ArraySpan input_span(*input);
+      Range range;
+      ARROW_ASSIGN_OR_RAISE(std::tie(range.offset, range.length),
+                            
list_util::internal::RangeOfValuesUsed(input_span));
+      value_ranges.push_back(range);

Review Comment:
   I don't mind the explicitness of `std::tie(range.offset, range.length)` as 
pairs (which I use a lot) have the problem that you need to understand the 
context to be sure about the meaning of the `.second` field — is it a length or 
the inclusive offset bound.



-- 
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]

Reply via email to