Skip to content

[BUG] PPL doesn't allow pure booleans in WHERE clauses #3273

@Swiddis

Description

@Swiddis

What is the bug?
In PPL WHERE clauses, most plain boolean expressions are failing. Two related repros below:

How can one reproduce the bug?

  1. Create a test index (here test_19a673e2) with at least two fields of type boolean (here x and y).
  2. First example: try to just select rows where x is truthy:
POST _plugins/_ppl
{
  "query": "SOURCE = test_19a673e2 | WHERE x"
}

Result:

{
  "error": {
    "reason": "Invalid Query",
    "details": "Failed to parse query due to offending symbol [<EOF>] at: 'SOURCE = test_19a673e2 | WHERE x' <--- HERE... More details: Expecting tokens in {'SEARCH', 'DESCRIBE', ..., BQUOTA_STRING}",
    "type": "SyntaxCheckException"
  },
  "status": 400
}
  1. Second example: forget boolean variables, just select all the rows with a no-op WHERE:
POST _plugins/_ppl
{
  "query": "SOURCE = test_19a673e2 | WHERE TRUE"
}

Result:

{
  "error": {
    "reason": "Invalid Query",
    "details": "Failed to parse query due to offending symbol [<EOF>] at: 'SOURCE = test_19a673e2 | WHERE TRUE' <--- HERE... More details: Expecting tokens in {'SEARCH', 'DESCRIBE', ..., BQUOTA_STRING}",
    "type": "SyntaxCheckException"
  },
  "status": 400
}
  1. Third example: the first example can be resolved by using x = TRUE instead of just x, but now let's try combining variables:
POST _plugins/_ppl
{
  "query": "SOURCE = test_19a673e2 | WHERE x OR y"
}

Result:

{
  "error": {
    "reason": "Invalid Query",
    "details": "Failed to parse query due to offending symbol [OR] at: 'SOURCE = test_19a673e2 | WHERE x OR' <--- HERE... More details: Expecting tokens in {'SEARCH', 'DESCRIBE', ..., BQUOTA_STRING}",
    "type": "SyntaxCheckException"
  },
  "status": 400
}

What is the expected behavior?
Logical expressions involving boolean variables should behave as expected.

What is your host/environment?

Do you have any screenshots?
N/A

Do you have any additional context?
Found by distributed-testing.

Metadata

Metadata

Assignees

Labels

PPLPiped processing languagebugSomething isn't workingdynamic-testIssues found by or related to Dynamic Testing

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions