Github user concretevitamin commented on a diff in the pull request:
https://github.com/apache/spark/pull/1359#discussion_r14781542
--- Diff:
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringOperations.scala
---
@@ -207,3 +210,64 @@ case class StartsWith(left: Expression, right:
Expression) extends StringCompari
case class EndsWith(left: Expression, right: Expression) extends
StringComparison {
def compare(l: String, r: String) = l.endsWith(r)
}
+
+/**
+ * A function that takes a substring of its first argument starting at a
given position.
+ * Defined for String and Binary types.
+ */
+case class Substring(str: Expression, pos: Expression, len: Expression)
extends Expression {
+
+ type EvaluatedType = Any
+
+ def nullable: Boolean = true
+ def dataType: DataType = {
+ if (str.dataType == BinaryType) str.dataType else StringType
--- End diff --
Hey Will -- I think we need to check if `resolved` is true here to not
break Catalyst's contract. Similar to
[here](https://github.com/apache/spark/blob/master/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/predicates.scala#L183).
---
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.
---