Skip to content

CheckAnalysis — Analysis Validation

CheckAnalysis is an extension of the PredicateHelper abstraction for logical analysis checkers that can check analysis phase.

CheckAnalysis defines extendedCheckRules extension point for extra analysis check rules.

Note

Only after analysis a logical query plan is correct and ready for execution.

Contract

isView

isView(
  nameParts: Seq[String]): Boolean

Used when:

Implementations

extendedCheckRules Extension Point

extendedCheckRules: Seq[LogicalPlan => Unit] = Nil

CheckAnalysis allows implementations for extra analysis check rules using extendedCheckRules extension point.

Used after the built-in check rules have been evaluated.

Checking Analysis Phase

checkAnalysis(
  plan: LogicalPlan): Unit

checkAnalysis checks (asserts) whether the given logical plan is correct using built-in and extended validation rules followed by marking it as analyzed.

checkAnalysis traverses the operators from their children first (up the operator chain).

checkAnalysis skips analysis if the plan has already been analyzed.

Unresolved Operators

checkAnalysis checks whether the plan has any logical plans unresolved. If so, checkAnalysis fails the analysis with the following error message:

unresolved operator [o.simpleString]

Logical Plan Analyzed

In the end, checkAnalysis marks the entire logical plan as analyzed.

Usage

checkAnalysis is used when:

checkShowPartitions

checkShowPartitions(
  showPartitions: ShowPartitions): Unit

checkShowPartitions branches off based on the input ShowPartitions.

For ShowPartitions with ResolvedTable child with a Table that is not SupportsPartitionManagement, checkShowPartitions failAnalysis with the following message:

SHOW PARTITIONS cannot run for a table which does not support partitioning

For ShowPartitions with ResolvedTable child with a Table that is SupportsPartitionManagement with no partitions, checkShowPartitions failAnalysis with the following message:

SHOW PARTITIONS is not allowed on a table that is not partitioned: [name]

Last update: 2021-06-05
Back to top