Skip to content

ResolveInlineTables Logical Resolution Rule

ResolveInlineTables is a logical resolution rule that <> in a logical query plan.

ResolveInlineTables is part of the Resolution fixed-point batch in the standard batches of the Analyzer.

ResolveInlineTables is a Catalyst rule for transforming logical plans, i.e. Rule[LogicalPlan].

[[conf]] [[creating-instance]] ResolveInlineTables takes a SQLConf when created.

Example

val q = sql("VALUES 1, 2, 3")
val plan = q.queryExecution.logical
scala> println(plan.numberedTreeString)
00 'UnresolvedInlineTable [col1], [List(1), List(2), List(3)]

scala> :type spark
org.apache.spark.sql.SparkSession

scala> :type spark.sessionState.conf
org.apache.spark.sql.internal.SQLConf

import org.apache.spark.sql.catalyst.analysis.ResolveInlineTables
val rule = ResolveInlineTables(spark.sessionState.conf)

val planAfterResolveInlineTables = rule(plan)
scala> println(planAfterResolveInlineTables.numberedTreeString)
00 LocalRelation [col1#2]

Executing Rule

apply(
  plan: LogicalPlan): LogicalPlan

apply simply searches the input plan upwards to find UnresolvedInlineTable logical operators with rows expressions resolved.

For such a UnresolvedInlineTable logical operator, apply validateInputDimension and validateInputEvaluable.

In the end, apply converts the UnresolvedInlineTable to a LocalRelation.

apply is part of the Rule abstraction.

=== [[validateInputDimension]] validateInputDimension Internal Method

[source, scala]

validateInputDimension(table: UnresolvedInlineTable): Unit

validateInputDimension...FIXME

NOTE: validateInputDimension is used exclusively when ResolveInlineTables logical resolution rule is <>.

=== [[validateInputEvaluable]] validateInputEvaluable Internal Method

[source, scala]

validateInputEvaluable(table: UnresolvedInlineTable): Unit

validateInputEvaluable...FIXME

NOTE: validateInputEvaluable is used exclusively when ResolveInlineTables logical resolution rule is <>.

=== [[convert]] Converting UnresolvedInlineTable to LocalRelation -- convert Internal Method

[source, scala]

convert(table: UnresolvedInlineTable): LocalRelation

convert...FIXME

NOTE: convert is used exclusively when ResolveInlineTables logical resolution rule is <>.