Skip to content

Commit

Permalink
fix: support typetracer in to_packed for IndexedOptionArray
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 committed Dec 21, 2023
1 parent a9c2e3b commit b408feb
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/awkward/contents/indexedoptionarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -1721,8 +1721,10 @@ def to_packed(self) -> Self:
original_index = self._index.raw(self._backend.nplike)
is_none = original_index < 0
num_none = self._backend.index_nplike.count_nonzero(is_none)
if self.parameter("__array__") == "categorical" or self._content.length <= (
len(original_index) - num_none
if (
self.parameter("__array__") == "categorical"
or not self._backend.index_nplike.known_data
or self._content.length <= (len(original_index) - num_none)
):
return ak.contents.IndexedOptionArray(
self._index, self._content.to_packed(), parameters=self._parameters
Expand Down

0 comments on commit b408feb

Please sign in to comment.