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]Support complex predicates for IF function in PPL #398

Closed
6 tasks
YANG-DB opened this issue Jun 25, 2024 · 2 comments
Closed
6 tasks

[FEATURE]Support complex predicates for IF function in PPL #398

YANG-DB opened this issue Jun 25, 2024 · 2 comments
Assignees
Labels
enhancement New feature or request Lang:PPL Pipe Processing Language support

Comments

@YANG-DB
Copy link
Member

YANG-DB commented Jun 25, 2024

Description

The predicate of function if(predicate, arg1, arg2) in PPL should support complex expression.
The current implementation only supports TrueLiteral and FalseLiteral, just like the example given in doc. Query such as |eval test=if(pgs > 2, "yes", "no") will fail with "details": "Failed to parse query due to offending symbol [>] at:

This PR aims to support complex predicate expression, following cases will be supported:

  • if(a > 2, arg1, arg2)
  • if(a != 2, arg1, arg2)
  • if(isnull(a), arg1, arg2)
  • if(not a>2, arg1, arg2)
  • if(not a in (0, 1), arg1, arg2)"
  • if(not a in (0, 1) OR isnull(a), arg1, arg2)
  • if(like(a, 'a%b%c_d'), arg1, arg2)
  • and more

Issues Resolved

Resolves opensearch-project/sql#2600 and opensearch-project/sql#2653

Check List

  • New functionality includes testing.
    • All tests pass, including unit test, integration test and doctest
  • New functionality has been documented.
    • New functionality has javadoc added
    • New functionality has user manual doc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

Additional Context

opensearch-project/sql#2756

@YANG-DB YANG-DB added enhancement New feature or request untriaged labels Jun 25, 2024
@YANG-DB YANG-DB self-assigned this Jun 25, 2024
@YANG-DB YANG-DB added the Lang:PPL Pipe Processing Language support label Jul 11, 2024
@dblock
Copy link
Member

dblock commented Jul 15, 2024

[Catch All Triage - 1, 2]

@dblock dblock removed the untriaged label Jul 15, 2024
@YANG-DB
Copy link
Member Author

YANG-DB commented Sep 13, 2024

This is replaced with CASE functionality

@YANG-DB YANG-DB closed this as completed 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 Lang:PPL Pipe Processing Language support
Projects
Status: Done
Development

No branches or pull requests

2 participants