Skip to content

Commit

Permalink
[SPARK-8223][SPARK-8224] removed toString; updated function description
Browse files Browse the repository at this point in the history
  • Loading branch information
tarekbecker committed Jul 2, 2015
1 parent 3b56f2a commit f628706
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 16 deletions.
6 changes: 2 additions & 4 deletions python/pyspark/sql/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -414,8 +414,7 @@ def sha2(col, numBits):

@since(1.5)
def shiftLeft(col, numBits):
"""Shift the the given value numBits left. Returns int for tinyint, smallint and int and
bigint for bigint a.
"""Shift the the given value numBits left.
>>> sqlContext.createDataFrame([(21,)], ['a']).select(shiftLeft('a', 1).alias('r')).collect()
[Row(r=42)]
Expand All @@ -427,8 +426,7 @@ def shiftLeft(col, numBits):

@since(1.5)
def shiftRight(col, numBits):
"""Shift the the given value numBits right. Returns int for tinyint, smallint and int and
bigint for bigint a.
"""Shift the the given value numBits right.
>>> sqlContext.createDataFrame([(42,)], ['a']).select(shiftRight('a', 1).alias('r')).collect()
[Row(r=21)]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,6 @@ case class ShiftLeft(left: Expression, right: Expression) extends BinaryExpressi
override protected def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode): String = {
nullSafeCodeGen(ctx, ev, (result, left, right) => s"$result = $left << $right;")
}

override def toString: String = s"ShiftLeft($left, $right)"
}

case class ShiftRight(left: Expression, right: Expression) extends BinaryExpression {
Expand Down Expand Up @@ -449,8 +447,6 @@ case class ShiftRight(left: Expression, right: Expression) extends BinaryExpress
override protected def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode): String = {
nullSafeCodeGen(ctx, ev, (result, left, right) => s"$result = $left >> $right;")
}

override def toString: String = s"ShiftRight($left, $right)"
}

/**
Expand Down
16 changes: 8 additions & 8 deletions sql/core/src/main/scala/org/apache/spark/sql/functions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1299,17 +1299,17 @@ object functions {
def rint(columnName: String): Column = rint(Column(columnName))

/**
* Shift the the given value numBits left. Returns int for tinyint, smallint and int and
* bigint for bigint a.
* Shift the the given value numBits left. If the given value is a long value, this function
* will return a long value else it will return an integer value.
*
* @group math_funcs
* @since 1.5.0
*/
def shiftLeft(e: Column, numBits: Integer): Column = ShiftLeft(e.expr, lit(numBits).expr)

/**
* Shift the the given value numBits left. Returns int for tinyint, smallint and int and
* bigint for bigint a.
* Shift the the given value numBits left. If the given value is a long value, this function
* will return a long value else it will return an integer value.
*
* @group math_funcs
* @since 1.5.0
Expand All @@ -1318,17 +1318,17 @@ object functions {
shiftLeft(Column(columnName), numBits)

/**
* Shift the the given value numBits right. Returns int for tinyint, smallint and int and
* bigint for bigint a.
* Shift the the given value numBits right. If the given value is a long value, it will return
* a long value else it will return an integer value.
*
* @group math_funcs
* @since 1.5.0
*/
def shiftRight(e: Column, numBits: Integer): Column = ShiftRight(e.expr, lit(numBits).expr)

/**
* Shift the the given value numBits right. Returns int for tinyint, smallint and int and
* bigint for bigint a.
* Shift the the given value numBits right. If the given value is a long value, it will return
* a long value else it will return an integer value.
*
* @group math_funcs
* @since 1.5.0
Expand Down

0 comments on commit f628706

Please sign in to comment.