From fb492c2e2788cd7066c233270959af906d35a673 Mon Sep 17 00:00:00 2001 From: Angus Hollands Date: Wed, 1 Nov 2023 20:00:03 +0000 Subject: [PATCH] feat: don't check masks by default --- src/awkward/operations/str/__init__.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/awkward/operations/str/__init__.py b/src/awkward/operations/str/__init__.py index a41dc64211..b07d252347 100644 --- a/src/awkward/operations/str/__init__.py +++ b/src/awkward/operations/str/__init__.py @@ -84,7 +84,7 @@ from awkward.operations.str.akstr_upper import * -def _drop_option_preserving_form(layout, ensure_trivial_mask: bool = True): +def _drop_option_preserving_form(layout, ensure_empty_mask: bool = False): from awkward._do import recursively_apply from awkward.contents import UnmaskedArray, IndexedOptionArray, IndexedArray @@ -98,7 +98,7 @@ def action(_, continuation, **kwargs): else: index_nplike = this.backend.index_nplike assert not ( - ensure_trivial_mask + ensure_empty_mask and index_nplike.known_data and index_nplike.any(this.mask_as_bool(valid_when=False)) ), "did not expect option type, but arrow returned a non-erasable option" @@ -121,6 +121,7 @@ def _apply_through_arrow( expect_option_type=False, string_to32=False, bytestring_to32=False, + ensure_empty_mask=False, **kwargs, ): from awkward._backends.dispatch import backend_of @@ -171,7 +172,7 @@ def _apply_through_arrow( if expect_option_type: return out else: - return _drop_option_preserving_form(out) + return _drop_option_preserving_form(out, ensure_empty_mask=ensure_empty_mask) def _get_ufunc_action(