-
Notifications
You must be signed in to change notification settings - Fork 141
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
Add position() function to V2 engine #1121
Add position() function to V2 engine #1121
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## 2.x #1121 +/- ##
============================================
- Coverage 98.30% 95.79% -2.51%
- Complexity 3470 3473 +3
============================================
Files 348 358 +10
Lines 8659 9326 +667
Branches 549 668 +119
============================================
+ Hits 8512 8934 +422
- Misses 142 334 +192
- Partials 5 58 +53
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
3e4209d
to
55c44ca
Compare
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com> Rebased
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
5c78ab6
to
52714ae
Compare
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
core/src/main/java/org/opensearch/sql/expression/text/TextFunction.java
Outdated
Show resolved
Hide resolved
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Returns 0 if substr is not in str? not -1?
what if POSITION('world' IN 'world')?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function is the synonym of the LOCATE
function. And works the same way in mySQL and legacy engine.
It returns 0, if substr in not in string like LOCATE
and POSITION
do in mySql and legacy engine.
POSITION('world' IN 'world')
would return 1 as the first argument matches the given string (2nd arg) starting from the 1st position.
There was a problem hiding this 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!
Signed-off-by: Margarit Hakobyan margarith@bitquilltech.com
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::
Issues Resolved
#1106
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.