Skip to content

Use Pyarrow 19 decimal32/64 objects in cudf Python - #18035

Closed
mroeschke wants to merge 22 commits into
NVIDIA:branch-25.04from
mroeschke:ref/pyarrow_19/decimal
Closed

Use Pyarrow 19 decimal32/64 objects in cudf Python#18035
mroeschke wants to merge 22 commits into
NVIDIA:branch-25.04from
mroeschke:ref/pyarrow_19/decimal

Conversation

@mroeschke

@mroeschke mroeschke commented Feb 19, 2025

Copy link
Copy Markdown
Contributor

Description

For Decimal32Dtype and Decimal64Dtype, we currently use pyarrow.Decimal128Type as their pyarrow representation. As of pyarrow 19, pyarrow.Decimal32Type and pyarrow.Decimal64Type types (and their arrays) exist allow us align their representation with their pyarrow representaions and with the libcudf decimal32/64 changes in #17422 to avoid conversions in the Python layer.

These changes do assume pyarrow>=19

The breaking changes are:

  • Decimal32/64Dtype.to_arrow return pyarrow.Decimal32/64Type respectively instead of pyarrow.Decimal128Type
  • Decimal32/64Column.from_arrow only accept pyarrow.Decimal32/64Array respectively instead of pyarrow.Decimal128Array

Checklist

  • I am familiar with the Contributing Guidelines.
  • New or existing tests cover these changes.
  • The documentation is up to date with these changes.

@mroeschke mroeschke added Python Affects Python cuDF API. improvement Improvement / enhancement to an existing function breaking Breaking change labels Feb 19, 2025
@mroeschke
mroeschke requested a review from a team as a code owner February 19, 2025 02:54
@github-actions github-actions Bot added the pylibcudf Issues specific to the pylibcudf package label Feb 19, 2025
},
{
"dtype": "decimal64",
"dtype": "decimal128",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this data is generated from the pyarrow representation of our type in addition to apache/arrow#45570, this data generation step will fail.

Just changing this to test decimal128 as it shouldn't drastically change the spirit of the test

@vyasr

vyasr commented Feb 24, 2025

Copy link
Copy Markdown
Contributor

Responding to #17922 (comment), that's a great point. Let's not bump the minimum requirement so quickly. Let's do conditional handling of decimal types based on the pyarrow version for the moment. libcudf can be built assuming that there is 32/64 bit decimal support in the spec, so no need for conditionals in our C++, and in Python we can branch on the pyarrow version at runtime.

rapids-bot Bot pushed a commit that referenced this pull request Feb 27, 2025
Broken off (the non-breaking parts) from #18035 as that PR will probably not move forward since it would require a pyarrow minimum version bump to 19

Authors:
  - Matthew Roeschke (https://github.com/mroeschke)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)

URL: #18111
@mroeschke
mroeschke marked this pull request as draft February 27, 2025 17:41
@copy-pr-bot

copy-pr-bot Bot commented Feb 27, 2025

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

@vyasr

vyasr commented Feb 27, 2025

Copy link
Copy Markdown
Contributor

Should we close this and just hold it off until whenever we upgrade?

@mroeschke

Copy link
Copy Markdown
Contributor Author

Sure, sounds good. I'll rebase this branch every so often locally

@mroeschke mroeschke closed this Feb 27, 2025
@github-project-automation github-project-automation Bot moved this from In Progress to Done in cuDF Python Feb 27, 2025
@mroeschke
mroeschke deleted the ref/pyarrow_19/decimal branch May 7, 2026 22:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

breaking Breaking change improvement Improvement / enhancement to an existing function pylibcudf Issues specific to the pylibcudf package Python Affects Python cuDF API.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants