Skip to content

[C++][Compute] case_when can accept incompatible parameterized value types and return corrupted results #50624

Description

@zanmato1984

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

case_when should either find a valid common output type for its value arguments or fail when the value types are incompatible.

On current main, some incompatible parameterized value types are incorrectly accepted and the call returns successful but corrupted results instead of failing.

I reproduced this on origin/main at aa78eb8973 on macOS arm64 (AppleClang 17) on July 23, 2026.

Using CallFunction("case_when", ...):

  1. fixed_size_binary width mismatch

Input:
case_when(cond=[true], left=["abcd"] as fixed_size_binary(4), right=["efghi"] as fixed_size_binary(5))

Actual:
OK [fixed_size_binary[5]]: ["abcdi"]

Expected:
The call should fail because the value argument types are incompatible.

  1. list value type mismatch

Input:
case_when(cond=[true], left=[[1, 2]] as list<int16>, right=[[3, 4]] as list<int32>)

Actual:
OK [list<item: int32>]: [[131073, 0]]

Expected:
The call should fail because the value argument types are incompatible.

  1. fixed_size_list size mismatch

Input:
case_when(cond=[true], left=[[1, 2]] as fixed_size_list<int32, 2>, right=[[3, 4, 5]] as fixed_size_list<int32, 3>)

Actual:
OK [fixed_size_list<item: int32>[3]]: [[1, 2, 0]]

Expected:
The call should fail because the value argument types are incompatible.

I also reproduced the same incorrect success for struct<a: int32> vs struct<a: int64>.

This looks like another instance of the broader exact-dispatch problem discussed in #47287, but here it affects case_when with incompatible parameterized value types.

Component(s)

C++

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions