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.

Creating Instance

ExplainCommand takes the following to be created:

ExplainCommand is created for EXPLAIN SQL statements (when SparkSqlAstBuilder is requested to visitExplain).

Output Attributes

ExplainCommand uses the following output attributes:

  • plan (type: StringType)

Executing Logical Command

  sparkSession: SparkSession): Seq[Row]

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:

run is part of the RunnableCommand abstraction.

Back to top