Skip to content

Dictionary columns (with a Boolean values) can't be used directly as filters #12380

@samuelcolvin

Description

@samuelcolvin

Describe the bug

Running

select count(*) v from dicts where json_contains(json_data, str_key2)

Where json_contains returns a Dictionary(UInt32, Boolean) (as of datafusion-contrib/datafusion-functions-json#39), results in:

called `Result::unwrap()` on an `Err` value: Plan("Cannot create filter with non-boolean predicate 'json_contains(dicts.json_data, dicts.str_key2)' returning Dictionary(UInt32, Boolean)")

If I change the sql to

select count(*) v from dicts where json_contains(json_data, str_key2) is true

Works fine.

Is this intended or a mistake?

To Reproduce

No response

Expected behavior

I would have assumed it should just work, but perhaps I'm mistaken?

Additional context

No response

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