Repository navigation
Add position() to V2 engine - #177
Conversation
Signed-off-by: Margarit Hakobyan <[email protected]>
Codecov Report
@@ Coverage Diff @@
## integ-add-position-to-v2 #177 +/- ##
==============================================================
- Coverage 98.29% 95.79% -2.51%
- Complexity 3465 3470 +5
==============================================================
Files 347 357 +10
Lines 8645 9314 +669
Branches 550 669 +119
==============================================================
+ Hits 8498 8922 +424
- Misses 142 334 +192
- Partials 5 58 +53
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
|
|
||
| /** | ||
| * POSITION(substr IN str) returns the position of the first occurrence of a substring in a string. | ||
| * If the substring is not found within the original string, this function returns 0. |
There was a problem hiding this comment.
Maybe: reference LOCATE function and signature (see other functions' docs).
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
| } | ||
|
|
||
| public UnresolvedExpression position(UnresolvedExpression left, UnresolvedExpression right) { | ||
| return new PositionFunction(left, right); |
There was a problem hiding this comment.
Same comment as above: can we used a better description than left and right?
| @ToString | ||
| public class PositionFunction extends UnresolvedExpression { | ||
| @Getter | ||
| private UnresolvedExpression left; |
There was a problem hiding this comment.
Same comment as above:
Can we used a better description than left and right?
| void position() { | ||
| FunctionExpression expression = DSL.position( | ||
| DSL.literal("world"), | ||
| DSL.literal("helloworld")); |
There was a problem hiding this comment.
can you change this to "helloworldworld"? Then it will also cover the duplicate case.
| assertEquals(INTEGER, expression.type()); | ||
| assertEquals(6, eval(expression).integerValue()); | ||
|
|
||
| when(nullRef.type()).thenReturn(STRING); |
There was a problem hiding this comment.
Can we split these out into null and missing tests.
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]> Rebased
Signed-off-by: Margarit Hakobyan <[email protected]> Rbased
Signed-off-by: Margarit Hakobyan <[email protected]> Rbased
This reverts commit eee57aa.
Signed-off-by: Margarit Hakobyan <[email protected]> Rbased
This reverts commit eee57aa.
Signed-off-by: Margarit Hakobyan <[email protected]> Rebased Signed-off-by: Margarit Hakobyan <[email protected]>
Signed-off-by: Margarit Hakobyan <[email protected]> Rbased Signed-off-by: Margarit Hakobyan <[email protected]>
This reverts commit eee57aa. Signed-off-by: Margarit Hakobyan <[email protected]>
Optional is not required since api returns list instead of object. Signed-off-by: Vijayan Balasubramanian <[email protected]>
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, INTEGER
Return type integer:
(STRING IN STRING) -> INTEGER
Example::
Issues Resolved
[List any issues this PR will resolve]
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.