Github user maropu commented on a diff in the pull request: https://github.com/apache/spark/pull/22227#discussion_r213540571 --- Diff: sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/regexpExpressions.scala --- @@ -229,33 +229,59 @@ case class RLike(left: Expression, right: Expression) extends StringRegexExpress /** - * Splits str around pat (pattern is a regular expression). + * Splits str around pattern (pattern is a regular expression). */ @ExpressionDescription( - usage = "_FUNC_(str, regex) - Splits `str` around occurrences that match `regex`.", + usage = "_FUNC_(str, regex, limit) - Splits `str` around occurrences that match `regex`" + + " and returns an array of at most `limit`", + arguments = """ + Arguments: + * str - a string expression to split. + * pattern - a string representing a regular expression. The pattern string should be a + Java regular expression. + * limit - an integer expression which controls the number of times the pattern is applied. + + limit > 0: + The resulting array's length will not be more than `limit`, and the resulting array's + last entry will contain all input beyond the last matched pattern. + + limit < 0: + `pattern` will be applied as many times as possible, and the resulting + array can be of any size. + + limit = 0: + `pattern` will be applied as many times as possible, the resulting array can + be of any size, and trailing empty strings will be discarded. + """, --- End diff -- How about this formatting?; ``` function_desc | Extended Usage: Arguments: * str - a string expression to split. * pattern - a string representing a regular expression. The pattern string should be a Java regular expression. * limit - an integer expression which controls the number of times the pattern is applied. limit > 0: The resulting array's length will not be more than `limit`, and the resulting array's last entry will contain all input beyond the last matched pattern. limit < 0: `pattern` will be applied as many times as possible, and the resulting array can be of any size. limit = 0: `pattern` will be applied as many times as possible, the resulting array can be of any size, and trailing empty strings will be discarded. Examples: > SELECT split('oneAtwoBthreeC', '[ABC]'); ["one","two","three",""] > SELECT split('oneAtwoBthreeC', '[ABC]', 0); ["one","two","three"] > SELECT split('oneAtwoBthreeC', '[ABC]', 2); ["one","twoBthreeC"] ```
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org