Skip to content

Commit 5f0ebdd

Browse files
committed
Match Scala/Python/R changes
1 parent a2ce0a2 commit 5f0ebdd

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

R/pkg/R/functions.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2632,8 +2632,8 @@ setMethod("date_sub", signature(y = "Column", x = "numeric"),
26322632

26332633
#' format_number
26342634
#'
2635-
#' Formats numeric column y to a format like '#,###,###.##', rounded to x decimal places,
2636-
#' and returns the result as a string column.
2635+
#' Formats numeric column y to a format like '#,###,###.##', rounded to x decimal places
2636+
#' with HALF_EVEN round mode, and returns the result as a string column.
26372637
#'
26382638
#' If x is 0, the result has no decimal point or fractional part.
26392639
#' If x < 0, the result will be null.
@@ -3548,7 +3548,7 @@ setMethod("row_number",
35483548

35493549
#' array_contains
35503550
#'
3551-
#' Returns true if the array contain the value.
3551+
#' Returns null if the array is null, true if the array contains the value, and false otherwise.
35523552
#'
35533553
#' @param x A Column
35543554
#' @param value A value to be checked if contained in the column

python/pyspark/sql/functions.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1327,8 +1327,8 @@ def encode(col, charset):
13271327
@since(1.5)
13281328
def format_number(col, d):
13291329
"""
1330-
Formats the number X to a format like '#,--#,--#.--', rounded to d decimal places,
1331-
and returns the result as a string.
1330+
Formats the number X to a format like '#,--#,--#.--', rounded to d decimal places
1331+
with HALF_EVEN round mode, and returns the result as a string.
13321332
13331333
:param col: the column name of the numeric value to be formatted
13341334
:param d: the N decimal places
@@ -1675,15 +1675,18 @@ def array(*cols):
16751675
@since(1.5)
16761676
def array_contains(col, value):
16771677
"""
1678-
Collection function: returns True if the array contains the given value. The collection
1679-
elements and value must be of the same type.
1678+
Collection function: returns null if the array is null, true if the array contains the
1679+
given value, and false otherwise.
16801680
16811681
:param col: name of column containing array
16821682
:param value: value to check for in array
16831683
16841684
>>> df = spark.createDataFrame([(["a", "b", "c"],), ([],)], ['data'])
16851685
>>> df.select(array_contains(df.data, "a")).collect()
16861686
[Row(array_contains(data, a)=True), Row(array_contains(data, a)=False)]
1687+
>>> df = spark.createDataFrame([(["1", "2", "3"],), ([],)], ['data'])
1688+
>>> df.select(array_contains(df.data, 1)).collect()
1689+
[Row(array_contains(data, 1)=True), Row(array_contains(data, 1)=False)]
16871690
"""
16881691
sc = SparkContext._active_spark_context
16891692
return Column(sc._jvm.functions.array_contains(_to_java_column(col), value))

0 commit comments

Comments
 (0)