Skip to content

Commit

Permalink
Start of Scala docs. Need to figure out how to compile the docs.
Browse files Browse the repository at this point in the history
  • Loading branch information
map222 committed Apr 3, 2017
1 parent 90d1150 commit 28f97d3
Showing 1 changed file with 28 additions and 4 deletions.
32 changes: 28 additions & 4 deletions sql/core/src/main/scala/org/apache/spark/sql/Column.scala
Original file line number Diff line number Diff line change
Expand Up @@ -781,15 +781,25 @@ class Column(val expr: Expression) extends Logging {
def isin(list: Any*): Column = withExpr { In(expr, list.map(lit(_).expr)) }

/**
* SQL like expression.
* SQL LIKE expression. For regex string searches, see rlike.
* {{{
* // find names that start with "Al"
* scala> df.filter( $"name".like("Al%") ).collect()
* Array([Alice,1])
* }}}
*
* @group expr_ops
* @since 1.3.0
*/
def like(literal: String): Column = withExpr { Like(expr, lit(literal).expr) }

/**
* SQL RLIKE expression (LIKE with Regex).
* Return a Boolean column based on a regex match.
* {{{
* // find names that end in "ice"
* scala> df.filter( $"name".rlike("ice$") ).collect()
* Array([Alice,1])
* }}}
*
* @group expr_ops
* @since 1.3.0
Expand Down Expand Up @@ -856,7 +866,14 @@ class Column(val expr: Expression) extends Logging {
def startsWith(other: Column): Column = withExpr { StartsWith(expr, lit(other).expr) }

/**
* String starts with another string literal.
* Return a Boolean Column based on a string match. Note you do not need regex ^.
* {{{
* // find names that start with "Al"
* scala> df.filter( $"name".startsWith("Al") ).collect()
* Array([Alice,1])
* scala> df.filter( $"name".startsWith("^Al") ).collect()
* Array()
* }}}
*
* @group expr_ops
* @since 1.3.0
Expand All @@ -872,7 +889,14 @@ class Column(val expr: Expression) extends Logging {
def endsWith(other: Column): Column = withExpr { EndsWith(expr, lit(other).expr) }

/**
* String ends with another string literal.
* Return a Boolean column based on string match. Note you do not need regex $.
* {{{
* // find names that end with "ice"
* scala> df.filter( $"name".endsWith("ice") ).collect()
* Array([Alice,1])
* scala> df.filter( $"name".endsWith("ice$") ).collect()
* Array()
* }}}
*
* @group expr_ops
* @since 1.3.0
Expand Down

0 comments on commit 28f97d3

Please sign in to comment.