BasicStatsPlanVisitor — Computing Statistics for Cost-Based Optimization¶
BasicStatsPlanVisitor
is a LogicalPlanVisitor that computes the statistics of a logical query plan for spark-sql-cost-based-optimization.md[cost-based optimization] (i.e. when spark-sql-cost-based-optimization.md#spark.sql.cbo.enabled[cost-based optimization is enabled]).
Note
Cost-based optimization is enabled when spark.sql.cbo.enabled configuration property is.
BasicStatsPlanVisitor
is used exclusively when a logical operator is requested for the statistics with cost-based optimization enabled.
BasicStatsPlanVisitor
comes with custom <
[[handlers]] .BasicStatsPlanVisitor's Visitor Handlers [cols="1,1,2",options="header",width="100%"] |=== | Logical Operator | Handler | Behaviour
| [[Aggregate]] Aggregate.md[Aggregate] | [[visitAggregate]] visitAggregate | Requests AggregateEstimation
for statistics estimates and query hints or falls back to SizeInBytesOnlyStatsPlanVisitor
| [[Filter]] Filter
| [[visitFilter]] visitFilter | Requests FilterEstimation
for statistics estimates and query hints or falls back to SizeInBytesOnlyStatsPlanVisitor
| [[Join]] Join.md[Join] | [[visitJoin]] visitJoin | Requests JoinEstimation
for statistics estimates and query hints or falls back to SizeInBytesOnlyStatsPlanVisitor
| [[Project]] Project.md[Project] | [[visitProject]] visitProject | Requests ProjectEstimation
for statistics estimates and query hints or falls back to SizeInBytesOnlyStatsPlanVisitor |===