Skip to content

ResolveDefaultColumns Logical Resolution Rule

ResolveDefaultColumns is a logical resolution rule (a Rule to transform a LogicalPlan) that resolves the following operators (top-down):

ResolveDefaultColumns is executed only when spark.sql.defaultColumn.enabled is enabled.

ResolveDefaultColumns is part of the Resolution fixed-point rule batch of the Analyzer.

Creating Instance

ResolveDefaultColumns takes the following to be created:

ResolveDefaultColumns is created when:

  • Analyzer is requested for the batches

Executing Rule

  plan: LogicalPlan): LogicalPlan

apply is part of the Rule abstraction.

Noop with spark.sql.defaultColumn.enabled disabled

ResolveDefaultColumns does nothing and returns the logical plan in-tact when spark.sql.defaultColumn.enabled is disabled.

With spark.sql.defaultColumn.enabled enabled, apply resolves the following operators (top-down):


For InsertIntoStatements that insertsFromInlineTable, apply resolveDefaultColumnsForInsertFromInlineTable.

For InsertIntoStatements with a Project query that is not a Star, apply resolveDefaultColumnsForInsertFromProject.


For UpdateTables, apply resolveDefaultColumnsForUpdate.


For MergeIntoTables, apply resolveDefaultColumnsForMerge.


  tableSchema: StructType,
  statementType: String): StructType

Only with spark.sql.defaultColumn.enabled enabled, constantFoldCurrentDefaultsToExistDefaults...FIXME

Otherwise, constantFoldCurrentDefaultsToExistDefaults does nothing (a noop) and returns the given table schema intact.

constantFoldCurrentDefaultsToExistDefaults is used when: