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