pyspark.pandas.DataFrame.spark.hint#

spark.hint(name, *parameters)#

Specifies some hint on the current DataFrame.

Parameters
nameA name of the hint.
parametersOptional parameters.
Returns
retDataFrame with the hint.

See also

broadcast

Marks a DataFrame as small enough for use in broadcast joins.

Examples

>>> df1 = ps.DataFrame({'lkey': ['foo', 'bar', 'baz', 'foo'],
...                     'value': [1, 2, 3, 5]},
...                    columns=['lkey', 'value']).set_index('lkey')
>>> df2 = ps.DataFrame({'rkey': ['foo', 'bar', 'baz', 'foo'],
...                     'value': [5, 6, 7, 8]},
...                    columns=['rkey', 'value']).set_index('rkey')
>>> merged = df1.merge(df2.spark.hint("broadcast"), left_index=True, right_index=True)
>>> merged.spark.explain()  
== Physical Plan ==
...
...BroadcastHashJoin...
...