zhengruifeng opened a new pull request, #47897:
URL: https://github.com/apache/spark/pull/47897

   ### What changes were proposed in this pull request?
   Compute all box plot metrics in single job
   
   
   ### Why are the changes needed?
   existing implementation computes the necessary metrics step by step:
   1, compute q1/q3/mean/median;
   2, compute the whiskers: min and max values of non-outliers;
   3, get top 1k outliers;
   
   it needs 3 jobs, however these metrics can be computed in single job.
   
   
   ### Does this PR introduce _any_ user-facing change?
   No
   
   
   ### How was this patch tested?
   CI and manually check
   
   ```
   import pandas as pd
   import numpy as np
   from datetime import datetime
   
   import pyspark.pandas as ps
   
   np.random.seed(123)
   pdf = pd.DataFrame(np.random.random([1000000, 5]), columns=["a", "b", "c", 
"d", "e"])
   psdf = ps.DataFrame(pdf)
   len(psdf)
   
   for i in range(20):
       a = psdf.boxplot()
   
   tic = datetime.now()
   for i in range(10):
       a = psdf.boxplot()
   datetime.now() - tic
   ```
   
   before:
   
   the avg computation duration is around 0.3 + 0.3 + 0.5 = 1.1 s,
   the last 3 runs:
   
![image](https://github.com/user-attachments/assets/638e0899-886f-46aa-b703-e196101aa327)
   
   after:
   
   the avg computation duration is around 0.8 ~ 0.9 s,
   the last 3 runs:
   
![image](https://github.com/user-attachments/assets/dfd6e129-5f61-4196-b7c3-d377a2deca84)
   
   
   ### Was this patch authored or co-authored using generative AI tooling?
   No
   


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