From f35dc0831bd2ee2b73604a705b0f44c413c381d0 Mon Sep 17 00:00:00 2001 From: Peter Fackeldey Date: Thu, 16 Jan 2025 08:46:07 -0500 Subject: [PATCH] fix _getitem_at_placeholder (#3368) --- src/awkward/contents/indexedarray.py | 2 +- src/awkward/contents/indexedoptionarray.py | 2 +- src/awkward/contents/listarray.py | 4 ++-- src/awkward/contents/listoffsetarray.py | 5 ++++- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/awkward/contents/indexedarray.py b/src/awkward/contents/indexedarray.py index 6ddcf3417c..6ab0e70cd1 100644 --- a/src/awkward/contents/indexedarray.py +++ b/src/awkward/contents/indexedarray.py @@ -289,7 +289,7 @@ def _getitem_nothing(self): return self._content._getitem_range(0, 0) def _is_getitem_at_placeholder(self) -> bool: - if isinstance(self._index, PlaceholderArray): + if isinstance(self._index.data, PlaceholderArray): return True return self._content._is_getitem_at_placeholder() diff --git a/src/awkward/contents/indexedoptionarray.py b/src/awkward/contents/indexedoptionarray.py index dc67d1ca3f..2fb939f014 100644 --- a/src/awkward/contents/indexedoptionarray.py +++ b/src/awkward/contents/indexedoptionarray.py @@ -310,7 +310,7 @@ def _getitem_nothing(self): return self._content._getitem_range(0, 0) def _is_getitem_at_placeholder(self) -> bool: - if isinstance(self._index, PlaceholderArray): + if isinstance(self._index.data, PlaceholderArray): return True return self._content._is_getitem_at_placeholder() diff --git a/src/awkward/contents/listarray.py b/src/awkward/contents/listarray.py index 9de9c65814..015379d5bf 100644 --- a/src/awkward/contents/listarray.py +++ b/src/awkward/contents/listarray.py @@ -311,8 +311,8 @@ def _getitem_nothing(self): return self._content._getitem_range(0, 0) def _is_getitem_at_placeholder(self) -> bool: - return isinstance(self._starts, PlaceholderArray) or isinstance( - self._stops, PlaceholderArray + return isinstance(self._starts.data, PlaceholderArray) or isinstance( + self._stops.data, PlaceholderArray ) def _getitem_at(self, where: IndexType): diff --git a/src/awkward/contents/listoffsetarray.py b/src/awkward/contents/listoffsetarray.py index f261717b87..9f0eaaa418 100644 --- a/src/awkward/contents/listoffsetarray.py +++ b/src/awkward/contents/listoffsetarray.py @@ -310,7 +310,10 @@ def _getitem_nothing(self): return self._content._getitem_range(0, 0) def _is_getitem_at_placeholder(self) -> bool: - return isinstance(self._offsets, PlaceholderArray) + return ( + isinstance(self._offsets.data, PlaceholderArray) + or self._content._is_getitem_at_placeholder() + ) def _getitem_at(self, where: IndexType): # Wrap `where` by length