Skip to content

Conversation

@margarit-h
Copy link
Contributor

@margarit-h margarit-h commented Dec 7, 2022

  • Add position() string function to PPL

Signed-off-by: Margarit Hakobyan [email protected]

Description

Usage: The syntax POSITION(substr IN str) returns the position of the first occurrence of substring substr in string str. Returns 0 if substr is not in str. Returns NULL if any argument is NULL.

Argument type: STRING, STRING

Return type INTEGER:

(STRING IN STRING) -> INTEGER

Example::

os> source=people | eval `POSITION('world' IN 'helloworld')` = POSITION('world' IN 'helloworld'), `POSITION('invalid' IN 'helloworld')`= POSITION('invalid' IN 'helloworld')  | fields `POSITION('world' IN 'helloworld')`, `POSITION('invalid' IN 'helloworld')`
fetched rows / total rows = 1/1
+-------------------------------------+---------------------------------------+
| POSITION('world' IN 'helloworld')   | POSITION('invalid' IN 'helloworld')   |
|-------------------------------------+---------------------------------------|
| 6                                   | 0                                     |
+-------------------------------------+---------------------------------------+

Issues Resolved

#1106

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.

* Add position() string function to PPL

Signed-off-by: Margarit Hakobyan <[email protected]>
@codecov-commenter
Copy link

codecov-commenter commented Dec 7, 2022

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 62.76%. Comparing base (354e843) to head (415e163).
⚠️ Report is 459 commits behind head on 2.x.

❌ Your project status has failed because the head coverage (62.76%) is below the target coverage (99.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (354e843) and HEAD (415e163). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (354e843) HEAD (415e163)
sql-engine 2 0
Additional details and impacted files
@@              Coverage Diff              @@
##                2.x    #1147       +/-   ##
=============================================
- Coverage     98.31%   62.76%   -35.55%     
=============================================
  Files           348       10      -338     
  Lines          8707      658     -8049     
  Branches        555      119      -436     
=============================================
- Hits           8560      413     -8147     
- Misses          142      192       +50     
- Partials          5       53       +48     
Flag Coverage Δ
query-workbench 62.76% <ø> (?)
sql-engine ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Yury-Fridlyand
Yury-Fridlyand previously approved these changes Dec 7, 2022
Signed-off-by: Margarit Hakobyan <[email protected]>
Copy link
Collaborator

@dai-chen dai-chen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the changes!

@Yury-Fridlyand Yury-Fridlyand merged commit f530770 into opensearch-project:2.x Dec 7, 2022
@Yury-Fridlyand Yury-Fridlyand deleted the integ-add-position-function-to-ppl branch December 7, 2022 19:25
@dai-chen dai-chen added enhancement New feature or request PPL Piped processing language labels Dec 8, 2022
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

None yet

Development

Successfully merging this pull request may close these issues.

4 participants