Skip to content

Commit 59860e7

Browse files
committed
add description of the parameter f and an example.
1 parent db528e4 commit 59860e7

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3455,6 +3455,11 @@ object functions {
34553455

34563456
/**
34573457
* Returns an array of elements for which a predicate holds in a given array.
3458+
* {{{
3459+
* df.selectExpr("filter(col, x -> x % 2 == 0)")
3460+
* }}}
3461+
*
3462+
* @param f: col => predicate, the boolean predicate to filter the input column
34583463
*
34593464
* @group collection_funcs
34603465
* @since 3.0.0
@@ -3465,6 +3470,12 @@ object functions {
34653470

34663471
/**
34673472
* Returns an array of elements for which a predicate holds in a given array.
3473+
* {{{
3474+
* df.selectExpr("filter(col, (x, i) -> i % 2 == 0)")
3475+
* }}}
3476+
*
3477+
* @param f: (col, index) => predicate, the boolean predicate to filter the input column
3478+
* given the index. Indices start at 0.
34683479
*
34693480
* @group collection_funcs
34703481
* @since 3.0.0

0 commit comments

Comments
 (0)