Skip to content

Commit

Permalink
[SPARK-28962][SQL][FOLLOW-UP] Add the parameter description for the S…
Browse files Browse the repository at this point in the history
…cala 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>
  • Loading branch information
gatorsmile authored and dongjoon-hyun committed Jan 24, 2020
1 parent 3f76bd4 commit ddf8315
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions sql/core/src/main/scala/org/apache/spark/sql/functions.scala
Expand Up @@ -3455,6 +3455,13 @@ object functions {

/**
* Returns an array of elements for which a predicate holds in a given array.
* {{{
* df.select(filter(col("s"), x => x % 2 === 0))
* df.selectExpr("filter(col, x -> x % 2 == 0)")
* }}}
*
* @param column: the input array column
* @param f: col => predicate, the boolean predicate to filter the input column
*
* @group collection_funcs
* @since 3.0.0
Expand All @@ -3465,6 +3472,14 @@ object functions {

/**
* Returns an array of elements for which a predicate holds in a given array.
* {{{
* df.select(filter(col("s"), (x, i) => i % 2 === 0))
* df.selectExpr("filter(col, (x, i) -> i % 2 == 0)")
* }}}
*
* @param column: the input array column
* @param f: (col, index) => predicate, the boolean predicate to filter the input column
* given the index. Indices start at 0.
*
* @group collection_funcs
* @since 3.0.0
Expand Down

0 comments on commit ddf8315

Please sign in to comment.