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: drop parameters for flattened RecordArray #1214

Merged
merged 5 commits into from
Jan 21, 2022

Conversation

agoose77
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Jan 11, 2022

Codecov Report

Merging #1214 (f6d675a) into main (ab65e20) will increase coverage by 0.14%.
The diff coverage is n/a.

Impacted Files Coverage Δ
src/awkward/_v2/contents/recordarray.py 79.74% <ø> (ø)
src/awkward/_v2/tmp_for_testing.py 13.52% <0.00%> (+8.21%) ⬆️

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.

That's looking good. The examples I wrote in Gitter could be used as a test.

>>> import awkward as ak
>>> from awkward._v2.tmp_for_testing import v1_to_v2
>>> stuffy = ak.Array([{"x": [[1, 2], []]}, {"x": []}, {"x": [[3]]}], with_name="Stuff")
>>> stuffy
<Array [{x: [[1, 2], []]}, ... {x: [[3]]}] type='3 * Stuff["x": var * var * int64]'>

>>> ak.flatten(stuffy, axis=2)
<Array [{x: [1, 2]}, {x: []}, {x: [3]}] type='3 * {"x": var * int64}'>

>>> stuffy_v2 = ak._v2.highlevel.Array(v1_to_v2(stuffy.layout))
>>> stuffy_v2
<Array [{x: [[1, 2], []]}, {...}, {x: [[3]]}] type='3 * Stuff[x: var * var *...'>

>>> ak._v2.highlevel.Array(stuffy_v2.layout.flatten(axis=2))
<Array [{x: [1, 2]}, {x: []}, {x: [3]}] type='3 * Stuff[x: var * int64]'>

>>> another = ak.Array([[{"x": 1}, {"x": 2}], [], [{"x": 3}]], with_name="Stuff")
>>> another
<Array [[{x: 1}, {x: 2}], [], [{x: 3}]] type='3 * var * Stuff["x": int64]'>

>>> ak.flatten(another, axis=1)
<Array [{x: 1}, {x: 2}, {x: 3}] type='3 * Stuff["x": int64]'>

>>> ak._v2.highlevel.Array(v1_to_v2(another.layout).flatten(axis=1))
<Array [{x: 1}, {x: 2}, {x: 3}] type='3 * Stuff[x: int64]'>

@agoose77
Copy link
Collaborator Author

Ha, thanks for the test cases. I only added a tiny test for the draft, this makes things a lot easier.

@agoose77 agoose77 marked this pull request as ready for review January 11, 2022 23:01
@jpivarski jpivarski enabled auto-merge (squash) January 11, 2022 23:04
@jpivarski
Copy link
Member

It's set to auto-merge.

@jpivarski
Copy link
Member

I bet the MacOS failure was due to the segfault issue (#1209), which is fixed in main, so I brought that up-to-date.

Also, this almost downgraded pybind11—you'd be the third to do that or almost do that. (See #1223!)

It's looking good now, so I'm going to auto-merge again.

@jpivarski jpivarski enabled auto-merge (squash) January 21, 2022 16:31
@jpivarski jpivarski merged commit a1a03db into main Jan 21, 2022
@jpivarski jpivarski deleted the fix-flatten-drop-parameters branch January 21, 2022 17:08
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