pitrou commented on code in PR #44053:
URL: https://github.com/apache/arrow/pull/44053#discussion_r1753644708


##########
cpp/src/arrow/compute/row/grouper.cc:
##########
@@ -292,6 +372,75 @@ struct AnyKeysSegmenter : public BaseRowSegmenter {
     } else {
       return Status::Invalid("segmenting unsupported datum kind ", 
datum.kind());
     }
+    ARROW_UNSUPPRESS_DEPRECATION_WARNING
+  }
+
+  Result<std::vector<Segment>> GetSegments(const ExecSpan& batch) override {
+    RETURN_NOT_OK(CheckForGetSegments(batch, {key_types_}));
+
+    if (batch.length == 0) {
+      return std::vector<Segment>{};
+    }
+
+    // determine if the first segment in this batch extends the last segment 
in the
+    // previous batch
+    bool extends = kDefaultExtends;
+    // the group id must be computed prior to resetting the grouper, since it 
is compared
+    // to save_group_id_, and after resetting the grouper produces 
incomparable group ids
+    ARROW_ASSIGN_OR_RAISE(auto group_id, MapGroupIdAt(batch));
+    // it "extends" unless the group id differs from the last group id
+    if (save_group_id_ != kNoGroupId && group_id != save_group_id_) {
+      extends = false;
+    }

Review Comment:
   Very small suggested improvement
   ```suggestion
       if (save_group_id_ != kNoGroupId) {
         // the group id must be computed prior to resetting the grouper, since 
it is compared
         // to save_group_id_, and after resetting the grouper produces 
incomparable group ids
         ARROW_ASSIGN_OR_RAISE(auto group_id, MapGroupIdAt(batch));
         // it "extends" unless the group id differs from the last group id
         extends = (group_id == save_group_id_);
       }
   ```



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