Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Swiddis opened this issue Jan 29, 2025 · 1 comment
Open

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

Swiddis opened this issue Jan 29, 2025 · 1 comment
Assignees
Labels
bug Something isn't working dynamic-test Issues found by or related to Dynamic Testing PPL Piped processing language

Comments

@Swiddis
Copy link
Collaborator

Swiddis commented Jan 29, 2025

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.

@Swiddis Swiddis added bug Something isn't working dynamic-test Issues found by or related to Dynamic Testing untriaged labels Jan 29, 2025
Swiddis added a commit to Swiddis/opensearch-sql-distributed-testing that referenced this issue Jan 29, 2025
@Swiddis Swiddis added PPL Piped processing language and removed untriaged labels Jan 29, 2025
@Swiddis Swiddis self-assigned this Jan 29, 2025
@Swiddis
Copy link
Collaborator Author

Swiddis commented Jan 29, 2025

Reproducer tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dynamic-test Issues found by or related to Dynamic Testing PPL Piped processing language
Projects
None yet
Development

No branches or pull requests

1 participant