opensearch-project / opensearch-spark

Spark Accelerator framework ; It enables secondary indices to remote data stores.
Apache License 2.0
12 stars 18 forks source link

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

Open YANG-DB opened 4 days ago

YANG-DB commented 4 days ago

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:

Issues Resolved

Resolves https://github.com/opensearch-project/sql/issues/2600 and https://github.com/opensearch-project/sql/issues/2653

Check List

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

https://github.com/opensearch-project/sql/pull/2756