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

Fix ColumnAccessor caching of nrows if empty previously #15710

Merged
merged 5 commits into from
May 13, 2024

Conversation

mroeschke
Copy link
Contributor

Description

#14758 may have propagated a caching invalidation bug of the number of rows in a ColumnAccessor

Previously the number of rows was cached and cleared only if an operation caused the ColumnAccessor to have no more columns.

However, if the ColumnAccessor was empty and operation added new columns, the cached number of rows should have also been cleared.

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 bug Something isn't working Python Affects Python cuDF API. non-breaking Non-breaking change labels May 10, 2024
@mroeschke mroeschke requested a review from a team as a code owner May 10, 2024 01:10
Comment on lines 356 to 357
new_ncols = len(self._data)
self._clear_cache(old_ncols, new_ncols)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think the invariant is new_ncols == old_ncols + 1? So no need to compute len here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call. Will swap to this

Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

hasattr evaluates the property which is not what you wanted, I think.

python/cudf/cudf/core/column_accessor.py Outdated Show resolved Hide resolved
Copy link
Contributor

@wence- wence- left a comment

Choose a reason for hiding this comment

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

/merge

@wence-
Copy link
Contributor

wence- commented May 13, 2024

/merge

@rapids-bot rapids-bot bot merged commit b4bdea2 into rapidsai:branch-24.06 May 13, 2024
70 checks passed
@mroeschke mroeschke deleted the columnaccessor/cache branch May 13, 2024 16:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working non-breaking Non-breaking change Python Affects Python cuDF API.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants