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

Make ListColumn.__init__ strict #16465

Merged
merged 6 commits into from
Aug 19, 2024

Conversation

mroeschke
Copy link
Contributor

@mroeschke mroeschke commented Aug 1, 2024

Description

This PR makes ListColumn.__init__ strict putting restrictions on data, dtype, size and children so these columns cannot be constructed into to an invalid state. It also aligns the signature with the base class.

xref #16469

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 non-breaking Non-breaking change labels Aug 1, 2024
@mroeschke mroeschke requested a review from a team as a code owner August 1, 2024 19:54
@mroeschke mroeschke requested review from vyasr and isVoid August 1, 2024 19:54
):
if data is not None:
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you want this to have the same signature as the base class. What does that actually get us? Does it help with dispatching somewhere?

More broadly, is there an issue tracking all these refactorings and explaining why they are being pursued?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry I added some context during today's meeting but you're right that I should probably be creating an issue for these themed PRs. I added some color in #16469

if not (
len(children) == 2
and isinstance(children[0], NumericalColumn)
# TODO: Enforce unsigned integers?
Copy link
Contributor

Choose a reason for hiding this comment

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

libcudf uses size_type for offsets, which is defined as int32_t (it is signed).

return offsets().begin<size_type>() + offset();

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah OK thanks!

@vyasr vyasr requested a review from bdice August 16, 2024 16:33
@mroeschke
Copy link
Contributor Author

/merge

@rapids-bot rapids-bot bot merged commit c516fc4 into rapidsai:branch-24.10 Aug 19, 2024
80 checks passed
@mroeschke mroeschke deleted the ref/listcol/strict branch August 19, 2024 16:55
rapids-bot bot pushed a commit to rapidsai/cugraph that referenced this pull request Aug 20, 2024
A recent API change in cudf (rapidsai/cudf#16465) now requires the `data` argument to be passed (consistent with the other Column subclasses)

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

Approvers:
  - Rick Ratzel (https://github.com/rlratzel)

URL: #4620
rapids-bot bot pushed a commit to rapidsai/cuspatial that referenced this pull request Aug 21, 2024
Post rapidsai/cudf#16465, the `data` argument to `ListColumn` is a required argument (as `None`)

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

Approvers:
  - Bradley Dice (https://github.com/bdice)

URL: #1442
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Improvement / enhancement to an existing function non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

3 participants