Kopīgot, izmantojot


bitmap_or_agg

Aggregate function: returns a bitmap that is the bitwise OR of all of the bitmaps from the input column. The input column should be bitmaps created from bitmap_construct_agg().

Syntax

import pyspark.sql.functions as sf

sf.bitmap_or_agg(col=<col>)

Parameters

Parameter Type Description
col pyspark.sql.Column or str The input column should be bitmaps created from bitmap_construct_agg().

Examples

Example 1: Using bitmap_or_agg function with binary data.

import pyspark.sql.functions as sf
df = spark.createDataFrame([("10",),("20",),("40",)], ["a"])
df.select(sf.bitmap_or_agg(sf.to_binary(df.a, sf.lit("hex")))).show()
+--------------------------------+
|bitmap_or_agg(to_binary(a, hex))|
+--------------------------------+
|            [70 00 00 00 00 0...|
+--------------------------------+