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: support all-None index in awkward_Index_nones_as_index.cpp #2769

Merged
merged 7 commits into from
Oct 24, 2023

Conversation

agoose77
Copy link
Collaborator

@agoose77 agoose77 commented Oct 24, 2023

This PR fixes #2768 by adding support for the all-none case to our awkward_Index_nones_as_index.cpp kernel. It also ensures that if we're argsorting the final dimension, we drop the option type from that dimension i.e. for this argsort result [10, 20, None, 5] → [3, 0, 1, 4] the array doesn't contain any None.

I think we should probably refactor this logic, but right now that's not the highest priority, so I've just patched

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Merging #2769 (d668e0c) into main (8927adb) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Additional details and impacted files
Files Coverage Δ
src/awkward/contents/indexedoptionarray.py 88.50% <100.00%> (+0.01%) ⬆️

@agoose77 agoose77 temporarily deployed to docs October 24, 2023 09:15 — with GitHub Actions Inactive
@agoose77 agoose77 marked this pull request as ready for review October 24, 2023 10:31
@agoose77 agoose77 temporarily deployed to docs October 24, 2023 11:08 — with GitHub Actions Inactive
Copy link
Member

@jpivarski jpivarski left a comment

Choose a reason for hiding this comment

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

Patching is good. The definition should also be updated here:

definition: |
def awkward_Index_nones_as_index(toindex, length):
last_index = 0
for i in range(length):
if toindex[i] > last_index:
last_index = toindex[i]
for i in range(length):
if toindex[i] == -1:
last_index = last_index + 1
toindex[i] = last_index

@agoose77
Copy link
Collaborator Author

The definition should also be updated here:

Eek, nearly forgot that. Thanks.

@agoose77 agoose77 enabled auto-merge (squash) October 24, 2023 17:00
@agoose77 agoose77 merged commit b333fe4 into main Oct 24, 2023
37 checks passed
@agoose77 agoose77 deleted the agoose77/fix-argsort-all-empty branch October 24, 2023 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

IndexError for ak.argsort on arrays with None
2 participants