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

objectID in nested field raises when using aggregate_polars_all

Open sibbiii opened this issue 8 months ago • 1 comments

Hi,

I really appreciate the support for polars, but

collection.insert_one({'obj': {'data_to_test': bson.ObjectId()}})
pymongoarrow.api.aggregate_polars_all(collection, [], 
                                      schema=pymongoarrow.api.Schema({'obj': {'data_to_test': bson.ObjectId}}))

raises with polars.exceptions.ComputeError: cannot create series from Extension("pymongoarrow.objectid", FixedSizeBinary(12), Some("")) as the casting of FixedSizeBinary is not done for nested fields.

Ps.: For not nested fields it works fine. Loading the arrow data frame also works fine. So this is not a showstopper, but it prohibits from using the aggregate_polars_all convenience function.

See #220 for a fix

sibbiii avatar Jun 17 '24 20:06 sibbiii