Skip to content

Commit 4d1a86f

Browse files
committed
Keep the old parameter name 'pattern' in split
1 parent 0a5e9a1 commit 4d1a86f

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

sql/core/src/main/scala/org/apache/spark/sql/functions.scala

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2463,22 +2463,22 @@ object functions {
24632463
* Splits str around matches of the given regex.
24642464
*
24652465
* @param str a string expression to split
2466-
* @param regex a string representing a regular expression. The regex string should be
2467-
* a Java regular expression.
2466+
* @param pattern a string representing a regular expression. The regex string should be
2467+
* a Java regular expression.
24682468
*
24692469
* @group string_funcs
24702470
* @since 1.5.0
24712471
*/
2472-
def split(str: Column, regex: String): Column = withExpr {
2473-
StringSplit(str.expr, Literal(regex), Literal(-1))
2472+
def split(str: Column, pattern: String): Column = withExpr {
2473+
StringSplit(str.expr, Literal(pattern), Literal(-1))
24742474
}
24752475

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

24982498
/**

sql/core/src/test/scala/org/apache/spark/sql/DataFrameSuite.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ class DataFrameSuite extends QueryTest
196196
test("explode on output of array-valued function") {
197197
val df = Seq(("1,2"), ("4"), ("7,8,9")).toDF("csv")
198198
checkAnswer(
199-
df.select(explode(split($"csv", ","))),
199+
df.select(explode(split($"csv", pattern = ","))),
200200
Row("1") :: Row("2") :: Row("4") :: Row("7") :: Row("8") :: Row("9") :: Nil)
201201
}
202202

0 commit comments

Comments
 (0)