-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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
[SPARK-31503][SQL] fix the SQL string of the TRIM functions #28281
Conversation
Thank you for pinging me, @cloud-fan . |
-- !query | ||
SELECT trim(BOTH 'xyz' FROM 'yxTomxx'), trim('xyz' FROM 'yxTomxx') | ||
-- !query schema | ||
struct<trim(yxTomxx, xyz):string,trim(yxTomxx, xyz):string> | ||
struct<TRIM(BOTH xyz FROM yxTomxx):string,TRIM(BOTH xyz FROM yxTomxx):string> |
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.
Got it.
Test build #121568 has finished for PR 28281 at commit
|
retest this please |
@dongjoon-hyun I think this bug exists the first day we add |
Test build #121575 has finished for PR 28281 at commit
|
Test build #121578 has finished for PR 28281 at commit
|
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. Thank you, @cloud-fan and @maropu .
Merged to master/3.0.
### What changes were proposed in this pull request? override the `sql` method of `StringTrim`, `StringTrimLeft` and `StringTrimRight`, to use the standard SQL syntax. ### Why are the changes needed? The current implementation is wrong. It gives you a SQL string that returns different result. ### Does this PR introduce any user-facing change? No ### How was this patch tested? new tests Closes #28281 from cloud-fan/sql. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit b209b5f) Signed-off-by: Dongjoon Hyun <[email protected]>
Could you make a backporting PR to branch-2.4? |
cc @holdenk since she is the release manager for 2.4.6. |
override the `sql` method of `StringTrim`, `StringTrimLeft` and `StringTrimRight`, to use the standard SQL syntax. The current implementation is wrong. It gives you a SQL string that returns different result. No new tests Closes apache#28281 from cloud-fan/sql. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]> (cherry picked from commit b209b5f) Signed-off-by: Dongjoon Hyun <[email protected]>
The backport PR: #28299 |
backport #28281 to 2.4 This backport has one difference: there is no `EXTRACT(... FROM ...)` SQL syntax in 2.4, so this PR just uses the common function call syntax. Closes #28299 from cloud-fan/pick. Authored-by: Wenchen Fan <[email protected]> Signed-off-by: Dongjoon Hyun <[email protected]>
What changes were proposed in this pull request?
override the
sql
method ofStringTrim
,StringTrimLeft
andStringTrimRight
, to use the standard SQL syntax.Why are the changes needed?
The current implementation is wrong. It gives you a SQL string that returns different result.
Does this PR introduce any user-facing change?
No
How was this patch tested?
new tests