Skip to content

[C++] Segmentation fault in pyarrow.compute.if_else: arguments have string type but the result only fits in large_string type #49310

@kccqzy

Description

@kccqzy

Describe the bug, including details regarding any error messages, version, and platform.

Run the following Python code:

import pyarrow
t = pyarrow.repeat('RANDOM_STR', 10**8)
f = pyarrow.repeat('RANDOM_STR_LARGE', 10**8)
m = pyarrow.repeat(False, 10**8)
pyarrow.compute.if_else(m, t, f)

This segfaults almost immediately on my computer.

The error message is Fatal Python error: Segmentation fault.

The cause of the issue that the arguments have string type but the result does not fit in the string type. If one were to cast the argument from string to large_string prior to calling if_else then it works.

This should either raise a proper exception in Python or silently do the cast for the user. It should not segfault.

Component(s)

Python

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions