Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Specifies some hint on the current DataFrame.
Syntax
hint(name: str, *parameters: Union["PrimitiveType", "Column", List["PrimitiveType"]])
Parameters
| Parameter | Type | Description |
|---|---|---|
name |
str | A name of the hint. |
parameters |
str, list, float or int | Optional parameters. |
Returns
DataFrame: Hinted DataFrame.
Examples
df = spark.createDataFrame([(2, "Alice"), (5, "Bob")], schema=["age", "name"])
df2 = spark.createDataFrame([Row(height=80, name="Tom"), Row(height=85, name="Bob")])
df.join(df2, "name").explain()
# == Physical Plan ==
# ...
# ... +- SortMergeJoin ...
# ...
df.join(df2.hint("broadcast"), "name").explain()
# == Physical Plan ==
# ...
# ... +- BroadcastHashJoin ...
# ...