[CALCITE-6445] Add REVERSE function (enabled in Spark library)#3830
Merged
Conversation
caicancai
reviewed
Jun 23, 2024
| } | ||
|
|
||
| /** | ||
| * Tests {@code REVERSE} function from Spark. |
NobiGo
requested changes
Jun 25, 2024
mihaibudiu
approved these changes
Jun 27, 2024
| | b | REGEXP_SUBSTR(string, regexp [, position [, occurrence]]) | Synonym for REGEXP_EXTRACT | ||
| | b m p s | REPEAT(string, integer) | Returns a string consisting of *string* repeated of *integer* times; returns an empty string if *integer* is less than 1 | ||
| | b m | REVERSE(string) | Returns *string* with the order of the characters reversed | ||
| | s | REVERSE( string | array ) | Returns *string* or *array* with the order of the characters reversed |
Contributor
There was a problem hiding this comment.
Returns string with the characters in reverse order or array with elements in reverse order
Contributor
Author
There was a problem hiding this comment.
Done, updated the description
NobiGo
requested changes
Jun 30, 2024
caicancai
reviewed
Jun 30, 2024
Member
There was a problem hiding this comment.
Most functions in Spark actually allow mixed use of numeric types, such as int and double, which will eventually be converted to the biggest type. For example
scala> val df = spark.sql("SELECT REVERSE(array(2, 1, 4, 3.0))")
df: org.apache.spark.sql.DataFrame = [reverse(array(2, 1, 4, 3.0)): array<decimal(11,1)>]
scala> df.show()
+----------------------------+
|reverse(array(2, 1, 4, 3.0))|
+----------------------------+
| [3.0, 4.0, 1.0, 2.0]|
+----------------------------+
Maybe we should write a method to imitate the operation of spark later.
caicancai
reviewed
Jun 30, 2024
NobiGo
approved these changes
Jul 8, 2024
|
Contributor
Author
|
@NobiGo @mihaibudiu Could you please merge this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



https://issues.apache.org/jira/browse/CALCITE-6445
Add Function REVERSE in Spark library.