Skip to content

Null constants can not be used in most expressions #1184

@alamb

Description

@alamb

Is your feature request related to a problem or challenge? Please describe what you are trying to do.

I want to be able to use null constants in my datafusion queries (e.g. NULL < 5). While at first this seems a silly usecase, we end up with such predicates during automated rewrites in IOx (where sometimes we replace column references with null constants -- See more details on https://github.com/influxdata/influxdb_iox/issues/883)

While they are allowed in the SQL or expr language (e.g. Expr::Literal(ScalarValue::Utf8(None))) they typically generate some runtime error before execution

Describe the solution you'd like
I want to be able to write expressions like NULL < 5 in all cases where I could write col < 5 and have DataFusion evaluate to the correct thing.

The proper fix for this ticket is likely first class support for DataType::Null and then proper coercion logic in the codebase as required. See the discussion by @Dandandan and @jimexist on #1179 at #1179 (comment)

Task List

Additional context
This is a tracking ticket for a variety of null incorrectness issues I found while working on #1179

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