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

String trim function returning incorrect results in Spark connect

    XMLWordPrintableJSON

Details

    Description

      With spark connect, the snippet: 

       

      import org.apache.spark.sql.functions.trim 
      import spark.implicits._ 
      
      val df = Seq((" john"), ("jane "), (" ann ")).toDF("name") 
      val trimmedDF = df.withColumn("name", trim($"name", " ")) 
      trimmedDF.collect()

      returns an incorrect result

      Array[Row] = Array([], [], [])

      We get the same result when using `rtrim` and `ltrim` as well.  
       

      Attachments

        Activity

          People

            biruktesf-db Biruk Tesfaye
            biruktesf-db Biruk Tesfaye
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified