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: sorting of record arrays without fields (ak.zip(tuple(...))) #3314

Merged
merged 1 commit into from
Nov 22, 2024

Conversation

pfackeldey
Copy link
Collaborator

@pfackeldey pfackeldey commented Nov 22, 2024

Fixes #1361 (comment).

It does not affect ak.argsort, because that does not even have an implementation for record arrays in the first place - it will raise a NotImplementedError as for now.

@pfackeldey pfackeldey changed the title fix: sorting of record arrays made of tuples fix: sorting of record arrays without fields (ak.zip(tuple(...))) Nov 22, 2024
@pfackeldey pfackeldey requested a review from jpivarski November 22, 2024 13:03
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.

I didn't realize that we support sorting on RecordArrays at all! At one point in the past, we decided that only numerical data should be sortable, but I just tested it (in records with named fields) and it does work in a reasonable way: lexicographically. Supporting the tuple case is therefore a logical completion.

Feel free to merge!

@pfackeldey pfackeldey merged commit 2009157 into main Nov 22, 2024
43 checks passed
@pfackeldey pfackeldey deleted the pfackeldey/fix_sort_recordarrays branch November 22, 2024 16:41
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.

ak.sort and ak.argsort should refuse to sort RecordArrays (raise a TypeError)
2 participants