説明する
デバッグ目的で、(論理プランと物理プランの)内容をコンソールに出力します。
構文
explain(extended: Optional[Union[bool, str]] = None, mode: Optional[str] = None)
パラメーター
パラメーター | Type | 説明 |
|---|---|---|
| ブール値、オプション | デフォルトは |
| 文字列、オプション | プランの出力形式を指定します。 |
例
Python
df = spark.createDataFrame(
[(14, "Tom"), (23, "Alice"), (16, "Bob")], ["age", "name"])
df.explain()
# == Physical Plan ==
# *(1) Scan ExistingRDD[age...,name...]
df.explain(extended=True)
# == Parsed Logical Plan ==
# ...
# == Analyzed Logical Plan ==
# ...
# == Optimized Logical Plan ==
# ...
# == Physical Plan ==
# ...
df.explain(mode="formatted")
# == Physical Plan ==
# * Scan ExistingRDD (...)
# (1) Scan ExistingRDD [codegen id : ...]
# Output [2]: [age..., name...]
# ...