You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
when I use pymongoarrow.api.aggregate_arrow_all() it seems to return Decimal128 as FixedSizeBinary when context.finish() is called.
When looking at the code, my assumption is, it stems from lib.pyx where return pyarrow_wrap_array(out).cast(Decimal128Type_()) in line 784 does not cast the fixed_sized_binary back to Decimal128.
thanks for the response. You are right, it works for top-level Decimal128.
Unfortunately, I have to deal with Objects that contain nested Decimal128 fields.
Example code:
frompymongoimportMongoClientfrombson.decimal128importDecimal128frompymongoarrow.apiimportaggregate_arrow_all# Connect to MongoDBclient=MongoClient("mongodb://localhost:27017/")
db=client["my_dummy_database"]
collection=db["my_dummy_collection"]
# Insert object with Decimal128collection.insert_one(
{
"name": "Product",
"price": {
"net": Decimal128("29.99"),
"gross": Decimal128("35.99"),
},
}
)
pipeline= [
{"$match": {"price.gross": {"$lt": Decimal128("50.00")}}},
]
# Execute aggregation and retrieve PyArrow Tablearrow_table=aggregate_arrow_all(collection, pipeline)
# Display the result and typeprint(f"types:\t{arrow_table["price"].type}")
print(f"values:\t{arrow_table["price"][0]}")
Hi,
when I use pymongoarrow.api.aggregate_arrow_all() it seems to return Decimal128 as FixedSizeBinary when context.finish() is called.
When looking at the code, my assumption is, it stems from lib.pyx where
return pyarrow_wrap_array(out).cast(Decimal128Type_())
in line 784 does not cast the fixed_sized_binary back to Decimal128.pymongo==4.6.2
pymongoarrow==1.3.0
pyarrow==15.0.1
The text was updated successfully, but these errors were encountered: