-
Notifications
You must be signed in to change notification settings - Fork 28.9k
[SPARK-28109][SQL] Fix TRIM(type trimStr FROM str) returns incorrect value #24911
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
Conversation
|
@wangyum . This is about new syntax. This is irrelevant to |
|
|
|
cc @gatorsmile |
| SELECT ltrim('xyxXxyLAST WORD', 'xy'), trim(LEADING 'xy' FROM 'xyxXxyLAST WORD'); | ||
| SELECT rtrim('testxxzx', 'xyz'), trim(TRAILING 'xyz' FROM 'testxxzx'); | ||
| SELECT rtrim('xyztestxxzx', 'xyz'), trim(TRAILING 'xyz' FROM 'xyztestxxzx'); | ||
| SELECT rtrim('TURNERyxXxy', 'xy'), trim(TRAILING 'xy' FROM 'TURNERyxXxy'); |
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.
Thank you for the new test coverage!
|
Test build #106680 has finished for PR 24911 at commit
|
|
|
||
| assertEqual( | ||
| intercept("select ltrim(both 'S' from 'SS abc S'", "mismatched input 'from' expecting {')'") | ||
| intercept("select rtrim(trailing 'S' from 'SS abc S'", "mismatched input 'from' expecting {')'") |
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 is the change of error message, but it looks okay. The previous error message is the following.
spark-sql> select ltrim(both 'S' from 'SS abc S';
Error in query:
missing ')' at '<EOF>'(line 1, pos 37)
== SQL ==
select ltrim(both 'S' from 'SS abc S'
-------------------------------------^^^
dongjoon-hyun
left a comment
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.
+1, LGTM.
Merged to master.
| } else { | ||
| funcID | ||
| } | ||
| } |
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.
The old one was a hacky way.
…rameter order issue ## What changes were proposed in this pull request? This pr backport #24902 and #24911 to branch-2.4. ## How was this patch tested? unit tests Closes #24907 from wangyum/SPARK-28093-branch-2.4. Authored-by: Yuming Wang <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…rameter order issue ## What changes were proposed in this pull request? This pr backport #24902 and #24911 to branch-2.3. ## How was this patch tested? unit tests Closes #24908 from wangyum/SPARK-28093-branch-2.3. Authored-by: Yuming Wang <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…rameter order issue ## What changes were proposed in this pull request? This pr backport apache#24902 and apache#24911 to branch-2.4. ## How was this patch tested? unit tests Closes apache#24907 from wangyum/SPARK-28093-branch-2.4. Authored-by: Yuming Wang <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
…rameter order issue ## What changes were proposed in this pull request? This pr backport apache#24902 and apache#24911 to branch-2.4. ## How was this patch tested? unit tests Closes apache#24907 from wangyum/SPARK-28093-branch-2.4. Authored-by: Yuming Wang <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
What changes were proposed in this pull request?
SPARK-28093 fixed
TRIM/LTRIM/RTRIM('str', 'trimStr')returns an incorrect value, but that fix introduced a new bug,TRIM(type trimStr FROM str)returns an incorrect value. This pr fix this issue.How was this patch tested?
unit tests and manual tests:
Before this PR:
After this PR:
And PostgreSQL: