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
}
TypeCoercionRule Contract — Type Coercion Rules
TypeCoercionRule is the contract of logical rules to coerce and propagate types in logical plans.
| Method | Description |
|---|---|
|
Coerce types in a logical plan Used exclusively when |
TypeCoercionRule is simply a Catalyst rule for transforming logical plans, i.e. Rule[LogicalPlan].
| TypeCoercionRule | Description |
|---|---|
CaseWhenCoercion |
|
ConcatCoercion |
|
DecimalPrecision |
|
Division |
|
EltCoercion |
|
FunctionArgumentConversion |
|
IfCoercion |
|
ImplicitTypeCasts |
|
PromoteStrings |
|
StackCoercion |
|
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:
-
The input LogicalPlan itself if matches the coerced plan
-
The plan after propagateTypes on the coerced plan
propagateTypes Internal Method
propagateTypes(plan: LogicalPlan): LogicalPlan
propagateTypes…FIXME
|
Note
|
propagateTypes is used exclusively when TypeCoercionRule is executed.
|