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

refactor: drop behavior broadcasting #2761

Merged
merged 4 commits into from
Oct 19, 2023

Conversation

agoose77
Copy link
Collaborator

@agoose77 agoose77 commented Oct 19, 2023

The behavior for one array given to broadcasting functions no longer needs to be broadcast against the other array behaviors. Thus, let's remove that restriction.

This would break users who introduce behaviors on array X, and expect ak.broadcast_arrays to merge them.

@agoose77 agoose77 requested a review from jpivarski October 19, 2023 16:24
@agoose77 agoose77 force-pushed the agoose77/refactor-drop-behavior-broadcast branch from 9fe07a2 to 0c4ddd8 Compare October 19, 2023 16:26
@agoose77
Copy link
Collaborator Author

agoose77 commented Oct 19, 2023

5a2a95a is preparation for another PR that made sense here.

@codecov
Copy link

codecov bot commented Oct 19, 2023

Codecov Report

Merging #2761 (0c4ddd8) into main (43adb65) will decrease coverage by 0.01%.
The diff coverage is 87.50%.

Additional details and impacted files
Files Coverage Δ
src/awkward/_broadcasting.py 95.43% <100.00%> (ø)
src/awkward/_connect/numexpr.py 90.66% <100.00%> (ø)
src/awkward/_connect/numpy.py 91.77% <100.00%> (ø)
src/awkward/_errors.py 78.86% <100.00%> (ø)
src/awkward/_layout.py 84.46% <100.00%> (ø)
src/awkward/_nplikes/__init__.py 80.95% <100.00%> (ø)
src/awkward/_nplikes/dispatch.py 96.00% <100.00%> (ø)
src/awkward/_slicing.py 86.59% <100.00%> (ø)
src/awkward/contents/content.py 76.16% <100.00%> (ø)
src/awkward/index.py 89.34% <100.00%> (ø)
... and 15 more

... and 1 file with indirect coverage changes

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.

Now that string-broadcasting is built-in, no longer comes from ak.behavior, the broadcast_and_apply function no longer needs to ask for it as an argument, and that decouples n-ary → n-ary functions so that they don't have to mix behaviors anymore.

You're right that this changes how ak.broadcast_arrays works, and is therefore a technically breaking change, but it is extremely niche. Behaviors are generally thought of as global settings (Coffea, Vector), and arrays can carry their own behavior just in case they're not. Encountering different behavior on the inputs to ak.broadcast_arrays would be that surprising, exceptional case. Depending on it would be very weird.

I think this can go in a patch release. And I'm happy with the changes as they are here; please go ahead and merge when you're ready!

@agoose77 agoose77 merged commit fa4b2bc into main Oct 19, 2023
36 checks passed
@agoose77 agoose77 deleted the agoose77/refactor-drop-behavior-broadcast branch October 19, 2023 18:56
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.

2 participants