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

Rule
apply(
  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):

InsertIntoStatement

For InsertIntoStatements that insertsFromInlineTable, apply resolveDefaultColumnsForInsertFromInlineTable.

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

UpdateTable

For UpdateTables, apply resolveDefaultColumnsForUpdate.

MergeIntoTable

For MergeIntoTables, apply resolveDefaultColumnsForMerge.

constantFoldCurrentDefaultsToExistDefaults

constantFoldCurrentDefaultsToExistDefaults(
  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: