ulrichurriola-parada-ops opened a new pull request, #24142:
URL: https://github.com/apache/datafusion/pull/24142

   BuildProbeJoinMetrics derives Clone and previously ran its elapsed_compute 
update from a Drop impl on itself. HashJoinExec::execute() clones this struct 
into the build-side future (collect_left_input) while the original is kept by 
HashJoinStream, so there are always two live instances for a 
CollectLeft/Partitioned join, and Drop fired once per instance.
   
   Since build_time/join_time are Arc<AtomicUsize>-backed and shared between 
clones, the clone dropped at build-completion time re-added whatever build_time 
had already accumulated (via ScopedTimerGuard flushing on every Pending poll) 
into elapsed_compute. The original then added the same build_time again at the 
end, plus join_time - inflating elapsed_compute by up to build_time on any hash 
join whose build side yields control before completing.
   
   Move the elapsed_compute update into a new ElapsedComputeFinalizer, held 
behind an Arc on BuildProbeJoinMetrics. Cloning the outer struct now only bumps 
the Arc's refcount instead of creating a second independent Drop, so the update 
runs exactly once, when the last clone is dropped, using the fully-accumulated 
final values.
   
   Added a regression test that reproduces the clone/drop sequence directly and 
asserts elapsed_compute == build_time + join_time exactly.
   


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


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to