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

   ### What changes were proposed in this pull request?
   Reimplement `hist` plot with Spark SQL
   
   ### Why are the changes needed?
   Reimplement `hist` plot with Spark SQL to support Spark Connect, since the 
`pyspark.ml.feature.Bucketizer` has not been supported with Spark Connect.
   
   
   ### Does this PR introduce _any_ user-facing change?
   yes, follow plotting functions are enabled in Spark Connect:
   
   - {Frame, Series}.plot.hist
   - {Frame, Series}.plot(kind="hist", ...)
   
   
   ### How was this patch tested?
   1, enabled parity tests;
   2, manually check with:
   ```
   import pyspark.pandas as ps
   import pandas as pd
   import numpy as np
   
   np.random.seed(123)
   df = pd.DataFrame(np.random.randint(1, 7, 6000), columns=['one'])
   df['two'] = df['one'] + np.random.randint(1, 7, 6000)
   df = ps.from_pandas(df)
   df.plot.hist(bins=12, alpha=0.5)
   ```
   
   before (Spark Classic):
   
![image](https://github.com/user-attachments/assets/4d99724f-0ca0-4871-8cb8-2c0774729f4f)
   
   after (Spark Connect):
   
![image](https://github.com/user-attachments/assets/3df617d7-27ea-47d5-9e7f-42be3c26d92c)
   
   
   
   ### 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