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


##########
cpp/src/arrow/acero/aggregate_internal.h:
##########
@@ -143,11 +143,10 @@ Status HandleSegments(RowSegmenter* segmenter, const 
ExecBatch& batch,
 }
 
 /// @brief Extract values of segment keys from a segment batch
-/// @param[out] values_ptr Vector to store the extracted segment key values
+/// @param[out] values Vector to store the extracted segment key values
 /// @param[in] input_batch Segment batch. Must have the a constant value for 
segment key
 /// @param[in] field_ids Segment key field ids
-Status ExtractSegmenterValues(std::vector<Datum>* values_ptr,
-                              const ExecBatch& input_batch,
+Status ExtractSegmenterValues(std::vector<Datum>& values, const ExecBatch& 
input_batch,

Review Comment:
   Hmm, could we keep the convention of avoiding mutable refs in APIs (even 
internal)? They help seeing _at the call site_ that some variable is going to 
be mutated.



##########
cpp/src/arrow/acero/aggregate_internal.cc:
##########
@@ -177,14 +177,11 @@ void AggregatesToString(std::stringstream* ss, const 
Schema& input_schema,
   *ss << ']';
 }
 
-Status ExtractSegmenterValues(std::vector<Datum>* values_ptr,
-                              const ExecBatch& input_batch,
+Status ExtractSegmenterValues(std::vector<Datum>& values, const ExecBatch& 
input_batch,
                               const std::vector<int>& field_ids) {
+  DCHECK_EQ(values.size(), field_ids.size());
   DCHECK_GT(input_batch.length, 0);
-  std::vector<Datum>& values = *values_ptr;
   int64_t row = input_batch.length - 1;
-  values.clear();
-  values.resize(field_ids.size());
   for (size_t i = 0; i < field_ids.size(); i++) {

Review Comment:
   I'm curious, do the `values[i]` assignments constitute races in themselves? 
Or are they ok for some reason?



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