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] Conditional statement not supported using Opensearch PPL #2600

Closed
ashishthakur55525 opened this issue Apr 1, 2024 · 2 comments · Fixed by #2756
Closed

[BUG] Conditional statement not supported using Opensearch PPL #2600

ashishthakur55525 opened this issue Apr 1, 2024 · 2 comments · Fixed by #2756
Assignees
Labels
bug Something isn't working

Comments

@ashishthakur55525
Copy link

Describe the bug

[BUG] Conditional statement not supported using Opensearch PPL.
As per documentation https://github.com/opensearch-project/sql/blob/2.x/docs/user/ppl/functions/condition.rst we can use IF statement to filter results which is fine as I used below

source = | where ins="<ins_name>" | where match(log, "%message%")| fields @timestamp, metric, pgs | eval test=if(pgs = "2", "yes", "no")| fields test, metric

Now in next use case if I wanted to use > or < to filter results, its not working its complaining (below error).

"details": "Failed to parse query due to offending symbol [>] at:

I have tried other options like "gt" lr "gte" with "". '' , `` but nothing works.

Next use-case would be case statement, how to use case statement here -- spent many days but didnt get single example anywhere and OPensearch gives weird error which you are not able to understand.
Please help!!! Has anyone done this before?

Related component

Search:Query Insights

To Reproduce

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

COndition statement should be supported and add more documentation.

Additional Details

Plugins
Please list all plugins currently enabled.

Screenshots
If applicable, add screenshots to help explain your problem.

Host/Environment (please complete the following information):

  • OS: [e.g. iOS]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@ashishthakur55525 ashishthakur55525 added bug Something isn't working untriaged labels Apr 1, 2024
@dblock dblock transferred this issue from opensearch-project/OpenSearch Apr 2, 2024
@vamsi-amazon
Copy link
Member

Hey @ashishthakur55525 if possible can you list out all the use cases that you are looking for. we will prioritize the if clause issue.

@ashishthakur55525
Copy link
Author

Sure
If statement is not working with >, <, >=, <= (gretaer than, less than) condition.
How to use case statement using PPL.
Do we support all functions like percentile, median etc.
In Opensearch PPL, cant we use global filters (like variables we have in Grafana)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

3 participants