Class CastRuleProvider
- java.lang.Object
-
- org.apache.flink.table.planner.functions.casting.CastRuleProvider
-
-
Constructor Summary
Constructors Constructor Description CastRuleProvider()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
canFail(LogicalType inputType, LogicalType targetType)
Resolves the rule and returns the result ofCastRule.canFail(LogicalType, LogicalType)
.static Object
cast(CastRule.Context context, LogicalType inputLogicalType, LogicalType targetLogicalType, Object value)
Create aCastExecutor
and execute the cast on the providedvalue
.static CastExecutor<?,?>
create(CastRule.Context context, LogicalType inputLogicalType, LogicalType targetLogicalType)
Create aCastExecutor
for the provided input type and target type.static boolean
exists(LogicalType inputType, LogicalType targetType)
Returnstrue
if and only if aCastRule
can be resolved for the provided input type and target type.static CastCodeBlock
generateCodeBlock(CodeGeneratorCastRule.Context context, String inputTerm, String inputIsNullTerm, LogicalType inputLogicalType, LogicalType targetLogicalType)
Create aCastCodeBlock
for the provided input type and target type.static CastRule<?,?>
resolve(LogicalType inputType, LogicalType targetType)
Resolve aCastRule
for the provided input type and target type.
-
-
-
Method Detail
-
resolve
@Nullable public static CastRule<?,?> resolve(LogicalType inputType, LogicalType targetType)
Resolve aCastRule
for the provided input type and target type. Returnsnull
if no rule can be resolved.
-
exists
public static boolean exists(LogicalType inputType, LogicalType targetType)
Returnstrue
if and only if aCastRule
can be resolved for the provided input type and target type.
-
canFail
public static boolean canFail(LogicalType inputType, LogicalType targetType)
Resolves the rule and returns the result ofCastRule.canFail(LogicalType, LogicalType)
. Fails withNullPointerException
if the rule cannot be resolved.
-
create
@Nullable public static CastExecutor<?,?> create(CastRule.Context context, LogicalType inputLogicalType, LogicalType targetLogicalType)
Create aCastExecutor
for the provided input type and target type. Returnsnull
if no rule can be resolved.
-
generateCodeBlock
@Nullable public static CastCodeBlock generateCodeBlock(CodeGeneratorCastRule.Context context, String inputTerm, String inputIsNullTerm, LogicalType inputLogicalType, LogicalType targetLogicalType)
Create aCastCodeBlock
for the provided input type and target type. Returnsnull
if no rule can be resolved or the resolved rule is not instance ofCodeGeneratorCastRule
.
-
cast
@Nullable public static Object cast(CastRule.Context context, LogicalType inputLogicalType, LogicalType targetLogicalType, Object value)
Create aCastExecutor
and execute the cast on the providedvalue
. Fails withIllegalArgumentException
if the rule cannot be resolved, or with an exception from theCastExecutor
itself if the rule can fail.
-
-