From 230fe1d9bcad0f48c942573063a7b298a9771ed8 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 21 Dec 2023 03:58:30 +0000 Subject: [PATCH 1/2] fix: lazily project union contents --- src/awkward/contents/unionarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/awkward/contents/unionarray.py b/src/awkward/contents/unionarray.py index fed19ebe42..6a16ee194b 100644 --- a/src/awkward/contents/unionarray.py +++ b/src/awkward/contents/unionarray.py @@ -708,7 +708,7 @@ def project(self, index): nextcarry = ak.index.Index64( tmpcarry.data[: lenout[0]], nplike=self._backend.index_nplike ) - return self._contents[index]._carry(nextcarry, False) + return self._contents[index]._carry(nextcarry, True) @staticmethod def regular_index( From b647a642c7ed446382b0788f6678a8c74b58e335 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Thu, 21 Dec 2023 13:07:54 +0000 Subject: [PATCH 2/2] fix: use simplified --- src/awkward/operations/ak_enforce_type.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/awkward/operations/ak_enforce_type.py b/src/awkward/operations/ak_enforce_type.py index e207d46e47..2bd5996a01 100644 --- a/src/awkward/operations/ak_enforce_type.py +++ b/src/awkward/operations/ak_enforce_type.py @@ -947,7 +947,7 @@ def _recurse_union_non_union( # Index over them index = ak.index.Index64(index_data) - return ak.contents.IndexedArray(index, next_content) + return ak.contents.IndexedArray.simplified(index, next_content) else: # Find the first content whose type equals the given type for tag, content in enumerate(layout.contents): # noqa: B007