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-28123][SQL] String Functions: support btrim #31128
Conversation
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #133922 has finished for PR 31128 at commit
|
Kubernetes integration test starting |
Kubernetes integration test status success |
Test build #133933 has finished for PR 31128 at commit
|
cc @cloud-fan |
There are a number of PRs floating around about this. For the record, I don't strongly oppose it, but, does not seem like a semantically useful function, even if some legacy DBs support it. |
This PR is different from the others, this is also because my previous misunderstanding of Then I created two PR as you know. But the two PR try to let After that, I Investigated other database and found This PR only need minor changes (such as giving |
Kubernetes integration test starting |
Kubernetes integration test status success |
@@ -872,31 +872,21 @@ object StringTrim { | |||
Examples: | |||
> SELECT _FUNC_(' SparkSQL '); | |||
SparkSQL | |||
> SELECT _FUNC_(BOTH FROM ' SparkSQL '); |
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.
it's a bit bad to drop these examples.
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.
Maybe we should think about a better way to add function alias, so that they can have their own examples.
Test build #133991 has finished for PR 31128 at commit
|
The function adopt the new PR #31390 |
What changes were proposed in this pull request?
Spark support
trim
/ltrim
/rtrim
now. The functionbtrim
is an alternate form ofTRIM(BOTH <chars> FROM <expr>)
.btrim
removes the longest string consisting only of specified characters from the start and end of a string.The mainstream database support this feature show below:
Postgresql
https://www.postgresql.org/docs/11/functions-binarystring.html
Vertica
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/SQLReferenceManual/Functions/String/BTRIM.htm?tocpath=SQL%20Reference%20Manual%7CSQL%20Functions%7CString%20Functions%7C_____5
Redshift
https://docs.aws.amazon.com/redshift/latest/dg/r_BTRIM.html
Druid
https://druid.apache.org/docs/latest/querying/sql.html#string-functions
Greenplum
http://docs.greenplum.org/6-8/ref_guide/function-summary.html
Why are the changes needed?
btrim is very useful.
Does this PR introduce any user-facing change?
Yes. btrim is a new function
How was this patch tested?
Jenkins test.