ishaaaan17 commented on PR #53160:
URL: https://github.com/apache/arrow/pull/53160#issuecomment-6222841951

   hi @dmitry-chirkov-dremio,
   
   thank you very much for the detailed review, and for catching the race 
condition in Acero!
   
   you are right. when the worker threads evaluate the same bound expression on 
different batches at the same time, they share `kernel_state`, and if the 
matcher is initialized on the first batch without any synchronization, it is a 
data race.
   
   i will work on these:
   1. add synchronization for the matcher initialization. i can use a 
`std::mutex` with double-checked locking, or follow any specific pattern 
@lriggs suggests.
   2. add a unit test where multiple threads use a fresh kernel state for the 
first time at the same time.
   3. add the benchmark you asked for in `scalar_string_benchmark.cc`, 
comparing a single batch against reusing across multiple batches using 
`FunctionExecutor`, and share the before/after numbers.
   
   thanks again for the guidance!


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