ビットまたは
すべての非 null 入力値のビット単位の OR を返します。入力値がない場合は null を返します。
構文
Python
from pyspark.sql import functions as sf
sf.bit_or(col)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
|
| ターゲットカラムをコンピュートに。 |
戻り値
pyspark.sql.Column: すべての非 null 入力値のビット単位の OR。入力値がない場合は null。
例
例1 : すべての非NULL値とのビットOR
Python
from pyspark.sql import functions as sf
df = spark.createDataFrame([[1],[1],[2]], ["c"])
df.select(sf.bit_or("c")).show()
Output
+---------+
|bit_or(c)|
+---------+
| 3|
+---------+
例2 : 一部のNULL値を含むビットOR
Python
from pyspark.sql import functions as sf
df = spark.createDataFrame([[1],[None],[2]], ["c"])
df.select(sf.bit_or("c")).show()
Output
+---------+
|bit_or(c)|
+---------+
| 3|
+---------+