Skip to content

ESQL: document boolean operators' behavior on NULLs #129314

Open
@alex-spies

Description

@alex-spies

This is coming up every now and then, and we'll get bug reports where a WHERE command behaves unexpectedly in case of null values in the fields. Most recently, this was raised in #129125.

I checked our docs and couldn't find an explanation of the ternary logic (true, false, null) in our docs. The crux is that

  • when an expression is null, combining with NOT, AND and OR will still result in null (for OR: unless the other operand is true, for AND: unless the other operand is false)
    and for a good reason: null means "I don't know the value", and thus the output of null AND true can only be null.

I think it'd be nice to structure our docs in a way that boolean operators are grouped together and give each of them a 3x3 (resp. 3x1) table of how they evaluate in case of true, false and null in each of their operands. Additionally, giving an example would be great - like the example from the linked issue:

  • WHERE process.name IS NULL AND NOT process.name == "svchost.exe" (this evaluates to WHERE null, which filters out all the rows - but this is expected, see my comment for an explanation)

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Analytics/ES|QLAKA ESQL>docsGeneral docs changesTeam:AnalyticsMeta label for analytical engine team (ESQL/Aggs/Geo)Team:DocsMeta label for docs team

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions