Skip to content

BUG: Assigning pd.NA to StringDtype column causes "Unknown error: Wrapping .. failed" after pd.concat with PyArrow#64339

Open
kjmin622 wants to merge 5 commits intopandas-dev:mainfrom
kjmin622:issue64320
Open

BUG: Assigning pd.NA to StringDtype column causes "Unknown error: Wrapping .. failed" after pd.concat with PyArrow#64339
kjmin622 wants to merge 5 commits intopandas-dev:mainfrom
kjmin622:issue64320

Conversation

@kjmin622
Copy link
Contributor

Comment on lines +2725 to +2734
# TODO: Remove this part when pa.if_else is fixed (GH#64320)
if isinstance(left, pa.ChunkedArray) and (
pa.types.is_string(left.type) or pa.types.is_large_string(left.type)
):
left = left.combine_chunks()

if isinstance(right, pa.ChunkedArray) and (
pa.types.is_string(right.type) or pa.types.is_large_string(right.type)
):
right = right.combine_chunks()
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PyArrow's pc.if_else misbehaves with chunked string arrays, causing PyArrow errors and data corruption; this fix call combine_chunks() on string/large_string ChunkedArrays in _if_else before invoking pc.if_else.

@kjmin622 kjmin622 marked this pull request as draft February 27, 2026 15:40
@kjmin622 kjmin622 marked this pull request as ready for review February 27, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

1 participant