Skip to content

ExplainCommand Logical Command

ExplainCommand is a logical command to display logical and physical query plans (with optional details about codegen and cost statistics) that represents EXPLAIN SQL statement at execution.

Creating Instance

ExplainCommand takes the following to be created:

ExplainCommand is created when:

Output Attributes

ExplainCommand uses the following output attributes:

  • plan (type: StringType)

Executing Command

RunnableCommand
run(
  sparkSession: SparkSession): Seq[Row]

run is part of the RunnableCommand abstraction.

run requests the given SparkSession for SessionState that is requested to execute the given LogicalPlan.

The result QueryExecution is requested to explainString with the given ExplainMode that becomes the output.

In case of a TreeNodeException, run gives the following output:

Error occurred during query planning:
[cause]