Skip to content

[C++] if_else crashes with a non-boolean condition and dictionary values #55960

In review

Description

@Chetansahney

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

if_else crashes the process when the condition is not boolean and both values have the same dictionary type:

import pyarrow as pa
import pyarrow.compute as pc

values = pa.array(["a", "b"]).dictionary_encode()
pc.if_else(pa.array([1, 0]), values, values)  # crash

With non-dictionary values the same call raises ArrowNotImplementedError: Function 'if_else' has no kernel matching input types (int64, int64, int64).

IfElseFunction::DispatchBest sends identical dictionary types straight to DispatchExactImpl and returns its result after only a DCHECK(kernel). With a non-boolean condition no kernel matches, so release builds return a null kernel, which is then called.

Reproduced with pyarrow 26.0.1 and a build of main on Windows 11 (exit code 0xC0000005, access violation).

Component(s)

C++

Activity

  1. added a commit that references this issue on Dec 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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