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: don't merge non-union parameters #2241

Merged
merged 2 commits into from
Feb 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/awkward/contents/unionarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1064,14 +1064,8 @@ def _reverse_merge(self, other):
AssertionError("FIXME: handle UnionArray with more than 127 contents")
)

parameters = ak.forms.form._parameters_union(
self._parameters,
other._parameters,
exclude=ak.forms.form.reserved_nominal_parameters,
)

return ak.contents.UnionArray.simplified(
tags, index, contents, parameters=parameters
tags, index, contents, parameters=self._parameters
agoose77 marked this conversation as resolved.
Show resolved Hide resolved
)

def _mergemany(self, others):
Expand Down
15 changes: 15 additions & 0 deletions tests/test_2240_merge_union_parameters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# BSD 3-Clause License; see https://github.com/scikit-hep/awkward-1.0/blob/main/LICENSE

import numpy as np # noqa: F401

import awkward as ak


def test():
one = ak.with_parameter([1, 2, [], [3, 4]], "one", "one")
two = ak.with_parameter([100, 200, 300], "two", "two")
three = ak.with_parameter([{"x": 1}, {"x": 2}, 5, 6, 7], "two", "two")

# No parameter unions should occur here
result = ak.concatenate((two, one, three))
assert ak.parameters(result) == {}