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

   ### What changes were proposed in this pull request?
   Implement `DataFrame.mapInArrow`.
   
   ### Why are the changes needed?
   Parity with vanilla PySpark.
   
   ### Does this PR introduce _any_ user-facing change?
   Yes. `DataFrame.mapInArrow` is supported as shown below.
   
   ```
   >>> import pyarrow
   >>> df = spark.createDataFrame([(1, 21), (2, 30)], ("id", "age"))
   >>> def filter_func(iterator):
   ...   for batch in iterator:
   ...     pdf = batch.to_pandas()
   ...     yield pyarrow.RecordBatch.from_pandas(pdf[pdf.id == 1])
   ... 
   >>> df.mapInArrow(filter_func, df.schema).show()
   +---+---+                                                                    
   
   | id|age|
   +---+---+
   |  1| 21|
   +---+---+
   ```
   
   ### 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-unsubscr...@spark.apache.org

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


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

Reply via email to