Github user chenghao-intel commented on a diff in the pull request:

    https://github.com/apache/spark/pull/2998#discussion_r19653069
  
    --- Diff: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala
 ---
    @@ -134,10 +157,51 @@ case class RLike(left: Expression, right: Expression)
       override def matches(regex: Pattern, str: String): Boolean = 
regex.matcher(str).find(0)
     }
     
    +
    +/**
    + * A function that strip whitespace (or other characters) from the 
beginning of a string
    + */
    +case class Ltrim(child: Expression) extends UnaryExpression with 
StringTransformationExpression {
    +
    +    override def convert(v: String): String = v.replaceAll("^\\s+", "")
    --- End diff --
    
    I am not so sure if the regex works here, but another option is likely to 
be use the `org.apache.commons.lang.StringUtils`, see 
https://github.com/apache/hive/blob/b8250ac2f30539f6b23ce80a20a9e338d3d31458/ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDFLTrim.java


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to