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

Add reverse() string function to V2 #183

Merged
merged 6 commits into from
Dec 9, 2022

Conversation

margarit-h
Copy link

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

Signed-off-by: Margarit Hakobyan margarith@bitquilltech.com

Description

Usage: REVERSE(str) returns reversed string of the string supplied as an argument. Returns NULL if the argument is NULL.

Argument type: STRING

Return type: STRING

Example::

os> SELECT REVERSE('abcde')
fetched rows / total rows = 1/1
+--------------------+
| REVERSE('abcde')   |
|--------------------|
| edcba              |
+--------------------+

Example::

os> source=people | eval `REVERSE('abcde')` = REVERSE('abcde') | fields `REVERSE('abcde')`
fetched rows / total rows = 1/1
+--------------------+
| REVERSE('abcde')   |
|--------------------|
| edcba              |
+--------------------+

Issues Resolved

[List any issues this PR will resolve]

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.

@codecov
Copy link

codecov bot commented Dec 6, 2022

Codecov Report

Merging #183 (272ca0e) into integ-add-reverse-to-v2 (2af7321) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@                    Coverage Diff                     @@
##             integ-add-reverse-to-v2     #183   +/-   ##
==========================================================
  Coverage                      98.30%   98.31%           
- Complexity                      3518     3521    +3     
==========================================================
  Files                            342      342           
  Lines                           8694     8700    +6     
  Branches                         554      554           
==========================================================
+ Hits                            8547     8553    +6     
  Misses                           142      142           
  Partials                           5        5           
Flag Coverage Δ
sql-engine 98.31% <100.00%> (+<0.01%) ⬆️

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

Impacted Files Coverage Δ
...c/main/java/org/opensearch/sql/expression/DSL.java 100.00% <100.00%> (ø)
...h/sql/expression/function/BuiltinFunctionName.java 100.00% <100.00%> (ø)
...g/opensearch/sql/expression/text/TextFunction.java 100.00% <100.00%> (ø)

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@margarit-h margarit-h changed the title [WIP:]Add reverse() string function to V2 Add reverse() string function to V2 Dec 6, 2022
@margarit-h margarit-h requested a review from a team December 6, 2022 20:04
docs/user/dql/functions.rst Show resolved Hide resolved
Description
>>>>>>>>>>>

Usage: REVERSE(str) returns reversed string of the string supplied as an argument. Returns NULL if the argument is NULL.

Choose a reason for hiding this comment

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

Since we're mentioning it here, we should add the NULL case to the test below

@Test
public void testReverse() throws IOException {
verifyQuery("reverse('hello')", "keyword", "olleh");
verifyQuery("reverse('')", "keyword", "");

Choose a reason for hiding this comment

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

null case?

Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
@margarit-h margarit-h force-pushed the dev-add-reverse-to-v2 branch from 4430764 to 555e1a0 Compare December 8, 2022 18:21
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
Signed-off-by: Margarit Hakobyan <margarith@bitquilltech.com>
@margarit-h margarit-h merged commit 2da8408 into integ-add-reverse-to-v2 Dec 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants