null이 아닌 모든 입력 값의 비트 OR을 반환하고, null이 없으면 null을 반환합니다.
문법
from pyspark.sql import functions as sf
sf.bit_or(col)
매개 변수
| 매개 변수 | 유형 | Description |
|---|---|---|
col |
pyspark.sql.Column 또는 열 이름 |
계산할 대상 열입니다. |
Returns
pyspark.sql.Column: null이 아닌 모든 입력 값의 비트 OR이거나, null이 아니면 null입니다.
예시
예제 1: Null이 아닌 값이 모두 있는 비트 OR
from pyspark.sql import functions as sf
df = spark.createDataFrame([[1],[1],[2]], ["c"])
df.select(sf.bit_or("c")).show()
+---------+
|bit_or(c)|
+---------+
| 3|
+---------+
예제 2: Null 값이 있는 비트 OR
from pyspark.sql import functions as sf
df = spark.createDataFrame([[1],[None],[2]], ["c"])
df.select(sf.bit_or("c")).show()
+---------+
|bit_or(c)|
+---------+
| 3|
+---------+