Spenserrrr commented on code in PR #59892:
URL: https://github.com/apache/spark/pull/59892#discussion_r4597139155


##########
python/pyspark/eval_handlers/_pandas.py:
##########
@@ -243,49 +246,106 @@ def __init__(
         )
 
     def run(self, split_index: int, data: "Iterator[pa.RecordBatch]") -> 
"Iterator[pa.RecordBatch]":

Review Comment:
   Yeah, I agree. For now, I moved the shared timer initialization into the 
base handler's `__init__` and bound the timers to `self`.



##########
python/pyspark/eval_handlers/_pandas.py:
##########
@@ -243,49 +246,106 @@ def __init__(
         )
 
     def run(self, split_index: int, data: "Iterator[pa.RecordBatch]") -> 
"Iterator[pa.RecordBatch]":
+        metrics = WorkerMetrics()
+        phase_timers = self._create_phase_timers()
+        clock = time.perf_counter_ns
+        input_preparation_duration_ns = 0

Review Comment:
   Moved the collector reference and timer handles into `__init__`. I kept the 
duration totals and batch count local to `run()`: they are updated inside the 
loop, and the exact bookkeeping can differ by eval type. Repeated `self` access 
can add a little overhead there, but keeping that state with the loop is the 
main reason. The timer handles are only read when publishing the totals.



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