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

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

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Won't Fix
    • 2.3.0, 2.3.1, 2.3.2, 2.3.3, 2.4.0, 2.4.1, 2.4.2, 2.4.3
    • None
    • SQL

    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

              Unassigned Unassigned
              yumwang Yuming Wang
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: