You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Biruk Tesfaye (Jira)" <ji...@apache.org> on 2024/07/10 08:48:00 UTC

[jira] [Created] (SPARK-48852) String trim function returning incorrect results in Spark connect

Biruk Tesfaye created SPARK-48852:
-------------------------------------

             Summary: String trim function returning incorrect results in Spark connect
                 Key: SPARK-48852
                 URL: https://issues.apache.org/jira/browse/SPARK-48852
             Project: Spark
          Issue Type: Bug
          Components: Connect
    Affects Versions: 3.5.0
            Reporter: Biruk Tesfaye


With spark connect, the snippet: 


 
{code:java}
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(){code}
returns an incorrect result
{code:java}
Array[Row] = Array([], [], []){code}
We get the same result when using `{{{}rtrim{}}}` and `{{{}ltrim{}}}` as well.  
 



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

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