Skip to content

NullableInterval::apply_operator returns incorrect values for Operator::And and Operator::Or #18626

@pepijnve

Description

@pepijnve

Describe the bug

The current implementation of apply_operator does not implement all possible cases of 'and' and 'or' correctly

To Reproduce

There are quite a few cases that are not correct. One example is

let t = NullableInterval::NotNull { values: Interval::CERTAINLY_TRUE };
let u = NullableInterval::Null { datatype: DataType::Boolean };
t.apply_operator(&Operator::Or, &u).unwrap();

In SQL true OR NULL evaluates to true, so this should return the same value as t. In practice the same value as u is returned.

Expected behavior

The interval arithmetic for boolean NullableInterval matches SQLs boolean arithmetic.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions