データセット と DataFrame ベースの結合コマンドで傾斜ヒントを指定する方法How to specify skew hints in dataset and DataFrame-based join commands
join
またはオブジェクトを使用してコマンドを実行するときに、 DataFrame
Dataset
データスキューによって少数のタスクを終了したときにクエリがスタックしていることがわかった場合は、メソッドを使用して傾斜ヒントを指定でき hint("skew")
ます df.hint("skew")
。When you perform a join
command with DataFrame
or Dataset
objects, if you find that the query is stuck on finishing a small number of tasks due to data skew, you can specify the skew hint with the hint("skew")
method: df.hint("skew")
. 傾斜結合の最適化は、ヒントを指定するで実行され DataFrame
skew
ます。The skew join optimization is performed on the DataFrame
for which you specify the skew
hint.
基本ヒントに加えて、 hint
列名、列名の一覧、列名、および傾斜値のパラメーターの組み合わせを使用して、メソッドを指定することもできます。In addition to the basic hint, you can specify the hint
method with the following combinations of parameters: column name, list of column names, and column name and skew value.
DataFrame
列名と列名を指定します。DataFrame
and column name. 傾斜結合の最適化は、の指定された列で実行されDataFrame
ます。The skew join optimization is performed on the specified column of theDataFrame
.df.hint("skew", "col1")
DataFrame
複数の列があります。DataFrame
and multiple columns. 傾斜結合の最適化は、の複数の列に対して実行されDataFrame
ます。The skew join optimization is performed for multiple columns in theDataFrame
.df.hint("skew", ["col1","col2"])
DataFrame
、列名、および傾斜値。DataFrame
, column name, and skew value. 傾斜結合の最適化は、傾斜値を持つ列のデータに対して実行されます。The skew join optimization is performed on the data in the column with the skew value.df.hint("skew", "col1", "value")
例Example
次の例では、操作に関係する複数のオブジェクトの傾斜ヒントを指定する方法を示し DataFrame
join
ます。This example shows how to specify the skew hint for multiple DataFrame
objects involved in a join
operation:
val joinResults = ds1.hint("skew").as("L").join(ds2.hint("skew").as("R"), $"L.col1" === $"R.col1")