@@ -1327,8 +1327,8 @@ def encode(col, charset):
13271327@since (1.5 )
13281328def 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 )
16761676def 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