explain
Prints the (logical and physical) plans to the console for debugging purposes.
Syntax
explain(extended: Optional[Union[bool, str]] = None, mode: Optional[str] = None)
Parameters
Parameter | Type | Description |
|---|---|---|
| bool, optional | default |
| str, optional | specifies the expected output format of plans. |
Examples
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...]
# ...