Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Python] Strange decimal cast when allow_decimal_truncate=True #44356

Open
stevenlandis-rl opened this issue Oct 9, 2024 · 0 comments
Open

Comments

@stevenlandis-rl
Copy link

stevenlandis-rl commented Oct 9, 2024

Describe the bug, including details regarding any error messages, version, and platform.

I'm using the python pyarrow module and running into this strange behavior when casting strings into a decimal:

pyarrow.compute.cast(
  pyarrow.array(['0.9999999999999999999999999999999999999999999999999999999999999999999999999']),
  options=pyarrow.compute.CastOptions(
    target_type=pyarrow.decimal128(38, 19),
    allow_decimal_truncate=True
  )
)

""" Returns:
<pyarrow.lib.Decimal128Array object at 0x11878c1c0>
[
  -3711.3482369388076293398
]
"""

Is this behavior expected?

Version: pyarrow==17.0.0

Component(s)

Python

@amoeba amoeba changed the title Strange decimal cast when allow_decimal_truncate=True [Python] Strange decimal cast when allow_decimal_truncate=True Oct 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant