Lưu ý
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử đăng nhập hoặc thay đổi thư mục.
Cần có ủy quyền mới truy nhập được vào trang này. Bạn có thể thử thay đổi thư mục.
Marks a DataFrame as small enough for use in broadcast joins. Supports Spark Connect.
Syntax
from pyspark.sql import functions as dbf
dbf.broadcast(df=<df>)
Parameters
| Parameter | Type | Description |
|---|---|---|
df |
pyspark.sql.DataFrame |
DataFrame to mark as ready for broadcast join. |
Returns
pyspark.sql.DataFrame: DataFrame marked as ready for broadcast join.
Examples
from pyspark.sql import functions as dbf
df = spark.createDataFrame([1, 2, 3, 3, 4], "int")
df_small = spark.range(3)
df_b = dbf.broadcast(df_small)
df.join(df_b, df.value == df_small.id).show()
+-----+---+
|value| id|
+-----+---+
| 1| 1|
| 2| 2|
+-----+---+