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/24 03:38:16 UTC

[GitHub] [spark] xinrong-meng opened a new pull request, #40539: [SPARK-42891][CONNECT][PYTHON][3.4] Implement CoGrouped Map API

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

   ### What changes were proposed in this pull request?
   Implement CoGrouped Map API: `applyInPandas`.
   
   ### Why are the changes needed?
   Parity with vanilla PySpark.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. CoGrouped Map API is supported as shown below.
   
   ```sh
   >>> import pandas as pd
   >>> df1 = spark.createDataFrame(
   ...   [(20000101, 1, 1.0), (20000101, 2, 2.0), (20000102, 1, 3.0), (20000102, 2, 4.0)], ("time", "id", "v1"))
   >>>
   >>> df2 = spark.createDataFrame(
   ...   [(20000101, 1, "x"), (20000101, 2, "y")], ("time", "id", "v2"))
   >>>
   >>> def asof_join(l, r):
   ...   return pd.merge_asof(l, r, on="time", by="id")
   ...
   >>> df1.groupby("id").cogroup(df2.groupby("id")).applyInPandas(
   ...   asof_join, schema="time int, id int, v1 double, v2 string"
   ... ).show()
   +--------+---+---+---+
   |    time| id| v1| v2|
   +--------+---+---+---+
   |20000101|  1|1.0|  x|
   |20000102|  1|3.0|  x|
   |20000101|  2|2.0|  y|
   |20000102|  2|4.0|  y|
   +--------+---+---+---+
   ```
   
   ### How was this patch tested?
   Parity 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] xinrong-meng closed pull request #40539: [SPARK-42891][CONNECT][PYTHON][3.4] Implement CoGrouped Map API

Posted by "xinrong-meng (via GitHub)" <gi...@apache.org>.
xinrong-meng closed pull request #40539: [SPARK-42891][CONNECT][PYTHON][3.4] Implement CoGrouped Map API
URL: https://github.com/apache/spark/pull/40539


-- 
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 #40539: [SPARK-42891][CONNECT][PYTHON][3.4] Implement CoGrouped Map API

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

   Merged to branch-3.4, thanks!


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