Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 10 additions & 10 deletions sql/core/src/main/scala/org/apache/spark/sql/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2460,25 +2460,25 @@ object functions {
def soundex(e: Column): Column = withExpr { SoundEx(e.expr) }

/**
* Splits str around matches of the given regex.
* Splits str around matches of the given pattern.
*
* @param str a string expression to split
* @param regex a string representing a regular expression. The regex string should be
* a Java regular expression.
* @param pattern a string representing a regular expression. The regex string should be
* a Java regular expression.
*
* @group string_funcs
* @since 1.5.0
*/
def split(str: Column, regex: String): Column = withExpr {
StringSplit(str.expr, Literal(regex), Literal(-1))
def split(str: Column, pattern: String): Column = withExpr {
StringSplit(str.expr, Literal(pattern), Literal(-1))
}

/**
* Splits str around matches of the given regex.
* Splits str around matches of the given pattern.
*
* @param str a string expression to split
* @param regex a string representing a regular expression. The regex string should be
* a Java regular expression.
* @param pattern a string representing a regular expression. The regex string should be
* a Java regular expression.
* @param limit an integer expression which controls the number of times the regex is applied.
* <ul>
* <li>limit greater than 0: The resulting array's length will not be more than limit,
Expand All @@ -2491,8 +2491,8 @@ object functions {
* @group string_funcs
* @since 3.0.0
*/
def split(str: Column, regex: String, limit: Int): Column = withExpr {
StringSplit(str.expr, Literal(regex), Literal(limit))
def split(str: Column, pattern: String, limit: Int): Column = withExpr {
StringSplit(str.expr, Literal(pattern), Literal(limit))
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ class DataFrameSuite extends QueryTest
test("explode on output of array-valued function") {
val df = Seq(("1,2"), ("4"), ("7,8,9")).toDF("csv")
checkAnswer(
df.select(explode(split($"csv", ","))),
df.select(explode(split($"csv", pattern = ","))),
Row("1") :: Row("2") :: Row("4") :: Row("7") :: Row("8") :: Row("9") :: Nil)
}

Expand Down