Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-28093

Built-in function trim/ltrim/rtrim has bug when using trimStr

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.4.2, 2.4.3
    • Fix Version/s: 3.0.0
    • Component/s: SQL
    • Labels:

      Description

      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>
      
      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)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                yumwang Yuming Wang
                Reporter:
                yumwang Yuming Wang
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: