是否有与 Spark Pandas UDF 等效的 Apache Arrow
Spark 提供了几种不同的方法来实现 使用并返回 Pandas DataFrame 的 UDF。我目前正在使用 联合版本,采用两个(联合分组)Pandas DataFrame 作为输入并返回第三个。
为了在 Spark DataFrame 和 Pandas DataFrame 之间进行高效转换,Spark 使用 Apache Arrow 内存布局,但是仍然需要在 Arrow 和 Pandas 之间进行转换。我真的很想直接访问 Arrow 数据,因为这就是我最终处理 UDF 中数据的方式(使用 极地)。
从 Spark 去似乎很浪费 ->箭头->熊猫 ->箭头(极地)在途中,在返回时相反。
Spark provides a few different ways to implement UDFs that consume and return Pandas DataFrames. I am currently using the cogrouped version that takes two (co-grouped) Pandas DataFrames as input and returns a third.
For efficient translation between Spark DataFrames and Pandas DataFrames, Spark uses the Apache Arrow memory layout, however transformation is still required to go from Arrow to Pandas and back. I would really like to access the Arrow data directly, as this is how I will ultimately be working with the data in the UDF (using Polars).
It seems wasteful to go from Spark -> Arrow -> Pandas -> Arrow (Polars) on the way in and the reverse on the return.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)