diff options
author | zhichao.li <zhichao.li@intel.com> | 2015-07-03 15:39:16 -0700 |
---|---|---|
committer | Davies Liu <davies.liu@gmail.com> | 2015-07-03 15:39:16 -0700 |
commit | ab535b9a1dab40ea7335ff9abb9b522fc2b5ed66 (patch) | |
tree | 45bbfbecf27e9875da72a1b0a036500746c63c21 /python/pyspark | |
parent | 2848f4da47d5c395de93ab9960bd905edfbd3439 (diff) | |
download | spark-ab535b9a1dab40ea7335ff9abb9b522fc2b5ed66.tar.gz spark-ab535b9a1dab40ea7335ff9abb9b522fc2b5ed66.tar.bz2 spark-ab535b9a1dab40ea7335ff9abb9b522fc2b5ed66.zip |
[SPARK-8226] [SQL] Add function shiftrightunsigned
Author: zhichao.li <zhichao.li@intel.com>
Closes #7035 from zhichao-li/shiftRightUnsigned and squashes the following commits:
6bcca5a [zhichao.li] change coding style
3e9f5ae [zhichao.li] python style
d85ae0b [zhichao.li] add shiftrightunsigned
Diffstat (limited to 'python/pyspark')
-rw-r--r-- | python/pyspark/sql/functions.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/python/pyspark/sql/functions.py b/python/pyspark/sql/functions.py index 12263e6a75..69e563ef36 100644 --- a/python/pyspark/sql/functions.py +++ b/python/pyspark/sql/functions.py @@ -436,6 +436,19 @@ def shiftRight(col, numBits): return Column(jc) +@since(1.5) +def shiftRightUnsigned(col, numBits): + """Unsigned shift the the given value numBits right. + + >>> sqlContext.createDataFrame([(-42,)], ['a']).select(shiftRightUnsigned('a', 1).alias('r'))\ + .collect() + [Row(r=9223372036854775787)] + """ + sc = SparkContext._active_spark_context + jc = sc._jvm.functions.shiftRightUnsigned(_to_java_column(col), numBits) + return Column(jc) + + @since(1.4) def sparkPartitionId(): """A column for partition ID of the Spark task. |