Github user OopsOutOfMemory commented on a diff in the pull request:
https://github.com/apache/spark/pull/2998#discussion_r19654021
--- 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+", "")
+
+ override def toString() = s"Ltrim($child)"
+}
+
+/**
+ * A function that strip whitespace (or other characters) from the end of
a string
+ */
+case class Rtrim(child: Expression) extends UnaryExpression with
StringTransformationExpression {
+
+ override def convert(v: String): String = v.replaceAll("\\s+$", "")
+
+ override def toString() = s"Rtrim($child)"
+}
+
+/**
+ * A function that calculate the length of a string
+ */
+case class Length(child: Expression) extends UnaryExpression with
StringCalculationExpression {
+
--- End diff --
so it is.
---
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]