Skip to content

Commit

Permalink
Add "where" method with String argument to DataFrame
Browse files Browse the repository at this point in the history
  • Loading branch information
sarutak committed Jun 28, 2015
1 parent 40648c5 commit d61aec4
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions sql/core/src/main/scala/org/apache/spark/sql/DataFrame.scala
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,18 @@ class DataFrame private[sql](
*/
def where(condition: Column): DataFrame = filter(condition)

/**
* Filters rows using the given SQL expression.
* {{{
* peopleDf.where("age > 15")
* }}}
* @group dfops
* @since 1.5.0
*/
def where(conditionExpr: String): DataFrame = {
filter(Column(new SqlParser().parseExpression(conditionExpr)))
}

/**
* Groups the [[DataFrame]] using the specified columns, so we can run aggregation on them.
* See [[GroupedData]] for all the available aggregate functions.
Expand Down

0 comments on commit d61aec4

Please sign in to comment.