[ 
https://issues.apache.org/jira/browse/SPARK-28093?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16870702#comment-16870702
 ] 

Xiao Li commented on SPARK-28093:
---------------------------------

The parameter orders might be different in different vendors. This is common. 
We can change it in 3.x to make it more consistent with the other vendors. 
However, it could break the existing customers' workloads if they already use 
trim. 

> Built-in function trim/ltrim/rtrim has bug when using trimStr
> -------------------------------------------------------------
>
>                 Key: SPARK-28093
>                 URL: https://issues.apache.org/jira/browse/SPARK-28093
>             Project: Spark
>          Issue Type: Bug
>          Components: SQL
>    Affects Versions: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.4.2, 2.4.3
>            Reporter: Yuming Wang
>            Assignee: Yuming Wang
>            Priority: Major
>              Labels: correctness, release-notes
>             Fix For: 2.4.4, 3.0.0
>
>
> {noformat}
> spark-sql> SELECT trim('yxTomxx', 'xyz'), trim('xxxbarxxx', 'x');
> z
> spark-sql> SELECT ltrim('zzzytest', 'xyz'), ltrim('xyxXxyLAST WORD', 'xy');
> xyz
> spark-sql> SELECT rtrim('testxxzx', 'xyz'), rtrim('TURNERyxXxy', 'xy');
> xy
> spark-sql>
> {noformat}
> {noformat}
> postgres=# SELECT trim('yxTomxx', 'xyz'), trim('xxxbarxxx', 'x');
>  btrim | btrim
> -------+-------
>  Tom   | bar
> (1 row)
> postgres=# SELECT ltrim('zzzytest', 'xyz'), ltrim('xyxXxyLAST WORD', 'xy');
>  ltrim |    ltrim
> -------+--------------
>  test  | XxyLAST WORD
> (1 row)
> postgres=# SELECT rtrim('testxxzx', 'xyz'), rtrim('TURNERyxXxy', 'xy');
>  rtrim |   rtrim
> -------+-----------
>  test  | TURNERyxX
> (1 row)
> {noformat}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to