You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "xinrong-meng (via GitHub)" <gi...@apache.org> on 2023/03/14 03:20:10 UTC

[GitHub] [spark] xinrong-meng opened a new pull request, #40405: [WIP][SPARK-42340][CONNECT][PYTHON] Implement `GroupedData.applyInPandas`

xinrong-meng opened a new pull request, #40405:
URL: https://github.com/apache/spark/pull/40405

   - [ ] Parity tests
   
   ### What changes were proposed in this pull request?
   Implement `GroupedData.applyInPandas`.
   
   ### Why are the changes needed?
   Parity with vanilla PySpark.
   
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. `GroupedData.applyInPandas` is supported now.
   
   
   ### How was this patch tested?
   Unit tests.
   


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #40405:
URL: https://github.com/apache/spark/pull/40405#issuecomment-1476024481

   Merged to master and branch-3.4.


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] xinrong-meng commented on pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng commented on PR #40405:
URL: https://github.com/apache/spark/pull/40405#issuecomment-1475524024

   @zhengruifeng @HyukjinKwon May I get a review, please?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon commented on PR #40405:
URL: https://github.com/apache/spark/pull/40405#issuecomment-1476027639

   It has a conflict with 3.4. mind creating a PR to backport this?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] zhengruifeng commented on pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "zhengruifeng (via GitHub)" <gi...@apache.org>.
zhengruifeng commented on PR #40405:
URL: https://github.com/apache/spark/pull/40405#issuecomment-1475525966

   A grouped data can also be created via `df.roll/cube/pivot`, do they works with `applyInPandas` ?


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] xinrong-meng commented on pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng commented on PR #40405:
URL: https://github.com/apache/spark/pull/40405#issuecomment-1475669732

   As long as the input relation is GroupedData, `applyInPandas` works.
   
   An example is as shown below:
   ```sh
   >>> df = spark.createDataFrame([(1, 1.0), (1, 2.0), (2, 3.0), (2, 5.0), (2, 10.0)],("id", "v"))
   >>> 
   >>> def normalize(pdf):
   ...     v = pdf.v
   ...     return pdf.assign(v=(v - v.mean()) / v.std())
   ... 
   
   >>> df.cube('id').applyInPandas(normalize, schema="id long, v double").show()
   +---+-------------------+
   | id|                  v|
   +---+-------------------+
   |  1|-0.7071067811865475|
   |  1| 0.7071067811865475|
   |  2|-0.8320502943378437|
   |  2|-0.2773500981126146|
   |  2| 1.1094003924504583|
   +---+-------------------+
   
   >>> df.rollup('id', df.v).applyInPandas(normalize, schema="id long, v double").show()
   +---+----+                                                                      
   | id|   v|
   +---+----+
   |  1|null|
   |  1|null|
   |  2|null|
   |  2|null|
   |  2|null|
   +---+----+
   
   # I didn't find `df.pivot` in vanilla PySpark.
   ```
   (the same result as vanilla PySpark).
   
   CC @zhengruifeng 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] xinrong-meng commented on pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng commented on PR #40405:
URL: https://github.com/apache/spark/pull/40405#issuecomment-1475716275

   Rebased to the latest master; no new changes after reviews. 


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] xinrong-meng commented on pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng commented on PR #40405:
URL: https://github.com/apache/spark/pull/40405#issuecomment-1476032014

   Sure, I'll do. Thanks @HyukjinKwon!


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon closed pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API

Posted by "HyukjinKwon (via GitHub)" <gi...@apache.org>.
HyukjinKwon closed pull request #40405: [SPARK-42340][CONNECT][PYTHON] Implement Grouped Map API
URL: https://github.com/apache/spark/pull/40405


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org