Skip to content

QueryStageExec Leaf Physical Operators

QueryStageExec is an extension of the LeafExecNode abstraction for leaf physical operators for Adaptive Query Execution.



cancel(): Unit

Cancels the stage materialization if in progress; otherwise does nothing.

Used when:


doMaterialize(): Future[Any]

Used when:

Runtime Statistics

getRuntimeStatistics: Statistics

Statistics after stage materialization

Used when:

Unique ID

id: Int

Used when:


  newStageId: Int,
  newOutput: Seq[Attribute]): QueryStageExec

Used when:

Physical Query Plan

plan: SparkPlan

The sub-tree of the main query plan of this query stage (that acts like a child operator, but QueryStageExec is a LeafExecNode and has no children)



_resultOption: AtomicReference[Option[Any]]

QueryStageExec uses a _resultOption transient volatile internal variable (of type AtomicReference) for the result of a successful materialization of the QueryStageExec operator (when preparing for query execution):

_resultOption is available using resultOption method. As AtomicReference is mutable that is enough to change the value.

_resultOption is set when AdaptiveSparkPlanExec physical operator is requested for the final physical plan.

resultOption is used when:

Computing Statistics

computeStats(): Option[Statistics]

computeStats uses the resultOption to access the underlying ReusedExchangeExec or Exchange physical operators.

If available, computeStats creates Statistics with the sizeInBytes as the dataSize performance metric of the physical operator.

Otherwise, computeStats returns no statistics.

computeStats is used when LogicalQueryStage logical operator is requested for the stats.

Materializing Query Stage

materialize(): Future[Any]

materialize prints out the following DEBUG message to the logs (with the id):

Materialize query stage [simpleName]: [id]

materialize doMaterialize.

Final Method

materialize is a Scala final method and may not be overridden in subclasses.

Learn more in the Scala Language Specification.

materialize is used when:

Text Representation

  depth: Int,
  lastChildren: Seq[Boolean],
  append: String => Unit,
  verbose: Boolean,
  prefix: String = "",
  addSuffix: Boolean = false,
  maxFields: Int,
  printNodeId: Boolean,
  indent: Int = 0): Unit

generateTreeString is part of the TreeNode abstraction.

generateTreeString generateTreeString (the default) followed by another generateTreeString (with the depth incremented).

Back to top