Github user HyukjinKwon commented on a diff in the pull request: https://github.com/apache/spark/pull/21037#discussion_r180739909 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/stringExpressions.scala --- @@ -1002,6 +1002,57 @@ case class StringInstr(str: Expression, substr: Expression) } } +/** + * A function that returns the position of the first occurrence of substr in the given string + * as BigInt. Returns 0 if substr could not be found in str. + * Returns null if either of the arguments are null and + * + * NOTE: that this is not zero based, but 1-based index. The first character in str has index 1. + */ +@ExpressionDescription( + usage = """ + _FUNC_(str, substr) - Returns the (1-based) index of the first occurrence of `substr` in `str`. + """, + examples = """ + Examples: + > SELECT _FUNC_('SparkSQL', 'SQL'); + 6 + """) --- End diff -- `since` :)?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org