Skip to content

Nullif func states support for Boolean type, but fails if this is attempted #4205

@stestagg

Description

@stestagg

Describe the bug
The nullif() reports that it supports Boolean arguments, but calling it with boolean arguments results in an internal error.

The message here suggests that Boolean is supported (When nullif is called with different unsupported types):

execute sql "select nullif('A', 'B')"
>> Error during planning: Coercion from [Utf8, Utf8] to the signature Uniform(2, [Boolean, UInt8, UInt16, UInt32, UInt64, Int8, Int16, Int32, Int64, Float32, Float64]) failed.

To Reproduce
evaluate: SELECT nullif(1=2, FALSE)

execute sql "select nullif(1 = 2, FALSE)"
>> External error: Internal error: Unsupported data type Boolean for NULLIF/primitive/boolean operator. This was likely caused by a bug in DataFusion's code and we would welcome that you file an bug report in our issue tracker

Expected behavior
Either Boolean is not listed as supported argument type, or the nullif() function performs as expected.

Additional context

So, it seems like Boolean is included in this list:

https://github.com/apache/arrow-datafusion/blob/d72b4f04cf12424a54b22bf376b87065d5fcb6aa/datafusion/expr/src/nullif.rs#L23

But in the match pattern here:

https://github.com/apache/arrow-datafusion/blob/d72b4f04cf12424a54b22bf376b87065d5fcb6aa/datafusion/physical-expr/src/expressions/nullif.rs#L46

It's not.

The underlying Arrow function does not support non-primitive array types in 0.26, but has recently been updated and in 0.27 now appears to:

apache/arrow-rs@3a90654

So I guess it's a case of waiting for the arrow dependency version to be bumped, but then the additional type(s) should probably be added in the datafusion files.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions