Skip to content

Commit ddf8315

Browse files
gatorsmiledongjoon-hyun
authored andcommitted
[SPARK-28962][SQL][FOLLOW-UP] Add the parameter description for the Scala function API filter
### What changes were proposed in this pull request? This PR is a follow-up PR #25666 for adding the description and example for the Scala function API `filter`. ### Why are the changes needed? It is hard to tell which parameter is the index column. ### Does this PR introduce any user-facing change? No ### How was this patch tested? N/A Closes #27336 from gatorsmile/spark28962. Authored-by: Xiao Li <gatorsmile@gmail.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com>
1 parent 3f76bd4 commit ddf8315

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

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

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

34563456
/**
34573457
* Returns an array of elements for which a predicate holds in a given array.
3458+
* {{{
3459+
* df.select(filter(col("s"), x => x % 2 === 0))
3460+
* df.selectExpr("filter(col, x -> x % 2 == 0)")
3461+
* }}}
3462+
*
3463+
* @param column: the input array column
3464+
* @param f: col => predicate, the boolean predicate to filter the input column
34583465
*
34593466
* @group collection_funcs
34603467
* @since 3.0.0
@@ -3465,6 +3472,14 @@ object functions {
34653472

34663473
/**
34673474
* Returns an array of elements for which a predicate holds in a given array.
3475+
* {{{
3476+
* df.select(filter(col("s"), (x, i) => i % 2 === 0))
3477+
* df.selectExpr("filter(col, (x, i) -> i % 2 == 0)")
3478+
* }}}
3479+
*
3480+
* @param column: the input array column
3481+
* @param f: (col, index) => predicate, the boolean predicate to filter the input column
3482+
* given the index. Indices start at 0.
34683483
*
34693484
* @group collection_funcs
34703485
* @since 3.0.0

0 commit comments

Comments
 (0)