mongo-arrow icon indicating copy to clipboard operation
mongo-arrow copied to clipboard

Does mongo-arrow provide real zero copy in the chain mongodb->arrow->pandas?

Open sergun opened this issue 1 year ago • 3 comments

.. or zero copy appear only between arrow->pandas but not here mongodb->arrow?

In other words are arrow data types used in mongodb?

sergun avatar Nov 07 '23 19:11 sergun

The MongoDB -> Arrow portion is not zero copy. This library translates (copies) MongoDB's BSON document result structure into Arrow's data format. There are no native Arrow types in MongoDB. Alternatively, the app can store Arrow data as opaque BSON binary data in MongoDB but then the app looses the ability to query the data.

ShaneHarvey avatar Nov 07 '23 19:11 ShaneHarvey

The MongoDB -> Arrow portion is not zero copy. This library translates (copies) MongoDB's BSON document result structure into Arrow's data format. There are no native Arrow types in MongoDB. Alternatively, the app can store Arrow data as opaque BSON binary data in MongoDB but then the app looses the ability to query the data.

Thanks a lot! Do you know if there are plans to make something like Arrow backend in MongoDB to store all documents internally in Arrow structures as it was made in pandas 2.x and in Spark?

PS. My original question was caused by use case of batch processing of data stored in MongoDB by logic expressed in pandas. Try to find some light-weight alternative to popular solution like Spark+pandas_udf (which uses Arrow end-to-end: Spark->Arrow->pandas).

sergun avatar Nov 07 '23 19:11 sergun

Hi @sergun, following up, no, there are no plans to change the storage format on MongoDB for alternate formats.

blink1073 avatar Mar 08 '24 21:03 blink1073