共用方式為


Shiftrightunsigned

未符號的值 numBits 向右移位。

關於對應的 Databricks SQL 函式,請參見 shiftrightunsigned 函數

語法

from pyspark.databricks.sql import functions as dbf

dbf.shiftrightunsigned(col=<col>, numBits=<numBits>)

參數

參數 類型 Description
col pyspark.sql.Columnstr 輸入欄位的值以進行移動。
numBits int 需要移位的位元數。

退貨

pyspark.sql.Column:數值轉移。

範例

from pyspark.databricks.sql import functions as dbf
spark.range(4).select("*", dbf.shiftrightunsigned(dbf.col('id') - 2, 1)).show()