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

[FEATURE]Add PPL eval CASE funcitonality support #3009

Open
YANG-DB opened this issue Sep 11, 2024 · 0 comments
Open

[FEATURE]Add PPL eval CASE funcitonality support #3009

YANG-DB opened this issue Sep 11, 2024 · 0 comments
Labels
enhancement New feature or request PPL Piped processing language

Comments

@YANG-DB
Copy link
Member

YANG-DB commented Sep 11, 2024

Is your feature request related to a problem?
Current CASE functionality syntax is only available in SQL query, this functionality is important for actual use cases for Observability and in addition more general cases where eval CASE add helpful functionality to the query.

What solution would you like?
The case command will be constructed using a list of predicates and an optional ELSE default value.

CASE(<predicate1>, <value1>, [<predicate2>, <value2>, ...] [ELSE] <default>)

ELSE could be optional, removing it will save an additional keyword in PPL. It is also more like a function than a clause.

An example :

source = my_index
| eval status_category =
    case(status_code >= 200 AND status_code < 300, 'Success',
         status_code >= 300 AND status_code < 400, 'Redirection'
         status_code >= 400 AND status_code < 500, 'Client Error'
         status_code >= 500, 'Server Error',
         'Unknown')
| stats count() by status_category

Do you have any additional context?

@YANG-DB YANG-DB added enhancement New feature or request untriaged PPL Piped processing language labels Sep 11, 2024
@YANG-DB YANG-DB removed the untriaged label Sep 11, 2024
@YANG-DB YANG-DB assigned YANG-DB and unassigned YANG-DB Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request PPL Piped processing language
Projects
Status: Todo
Development

No branches or pull requests

1 participant