TypeCoercionRule Contract — Type Coercion Rules

TypeCoercionRule is the contract of logical rules to coerce and propagate types in logical plans.

package org.apache.spark.sql.catalyst.analysis

trait TypeCoercionRule extends Rule[LogicalPlan] {
  // only required methods that have no implementation
  // the others follow
  def coerceTypes(plan: LogicalPlan): LogicalPlan
}
Table 1. (Subset of) TypeCoercionRule Contract
Method Description

coerceTypes

Coerce types in a logical plan

Used exclusively when TypeCoercionRule is executed

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

Table 2. TypeCoercionRules
TypeCoercionRule Description

CaseWhenCoercion

ConcatCoercion

DecimalPrecision

Division

EltCoercion

FunctionArgumentConversion

IfCoercion

ImplicitTypeCasts

InConversion

PromoteStrings

StackCoercion

WindowFrameCoercion

Executing Rule — apply Method

apply(plan: LogicalPlan): LogicalPlan
Note
apply is part of the Rule Contract to execute (apply) a rule on a TreeNode (e.g. LogicalPlan).

apply coerceTypes in the input LogicalPlan and returns the following:

propagateTypes Internal Method

propagateTypes(plan: LogicalPlan): LogicalPlan

propagateTypes…​FIXME

Note
propagateTypes is used exclusively when TypeCoercionRule is executed.

results matching ""

    No results matching ""