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


##########
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:
   Sorry, my wording is not accurate. By
   > The assignments never cause real race.
   
   I mean "the assignments never really cause race" (race is race, textbook 
TSAN flagging race) - because the for loop will only be entered 
single-threaded. The assignments look like racing because this function look 
like to execute multi-threaded - but that is prevented by [1].
   
   
https://github.com/apache/arrow/blob/fc0862a25fa2d6aa17df14daa9ad37430d432425/cpp/src/arrow/acero/scalar_aggregate_node.cc#L178-L180



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to