Class CastRuleProvider
java.lang.Object
org.apache.flink.table.planner.functions.casting.CastRuleProvider
This class resolves
CastRule using the input and the target type.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancanFail(org.apache.flink.table.types.logical.LogicalType inputType, org.apache.flink.table.types.logical.LogicalType targetType) Resolves the rule and returns the result ofCastRule.canFail(LogicalType, LogicalType).static Objectcast(CastRule.Context context, org.apache.flink.table.types.logical.LogicalType inputLogicalType, org.apache.flink.table.types.logical.LogicalType targetLogicalType, Object value) Create aCastExecutorand execute the cast on the providedvalue.static org.apache.flink.table.data.utils.CastExecutor<?,?> create(CastRule.Context context, org.apache.flink.table.types.logical.LogicalType inputLogicalType, org.apache.flink.table.types.logical.LogicalType targetLogicalType) Create aCastExecutorfor the provided input type and target type.static booleanexists(org.apache.flink.table.types.logical.LogicalType inputType, org.apache.flink.table.types.logical.LogicalType targetType) Returnstrueif and only if aCastRulecan be resolved for the provided input type and target type.static CastCodeBlockgenerateCodeBlock(CodeGeneratorCastRule.Context context, String inputTerm, String inputIsNullTerm, org.apache.flink.table.types.logical.LogicalType inputLogicalType, org.apache.flink.table.types.logical.LogicalType targetLogicalType) Create aCastCodeBlockfor the provided input type and target type.static CastRule<?,?> resolve(org.apache.flink.table.types.logical.LogicalType inputType, org.apache.flink.table.types.logical.LogicalType targetType) Resolve aCastRulefor the provided input type and target type.
-
Constructor Details
-
CastRuleProvider
public CastRuleProvider()
-
-
Method Details
-
resolve
@Nullable public static CastRule<?,?> resolve(org.apache.flink.table.types.logical.LogicalType inputType, org.apache.flink.table.types.logical.LogicalType targetType) Resolve aCastRulefor the provided input type and target type. Returnsnullif no rule can be resolved. -
exists
public static boolean exists(org.apache.flink.table.types.logical.LogicalType inputType, org.apache.flink.table.types.logical.LogicalType targetType) Returnstrueif and only if aCastRulecan be resolved for the provided input type and target type. -
canFail
public static boolean canFail(org.apache.flink.table.types.logical.LogicalType inputType, org.apache.flink.table.types.logical.LogicalType targetType) Resolves the rule and returns the result ofCastRule.canFail(LogicalType, LogicalType). Fails withNullPointerExceptionif the rule cannot be resolved. -
create
@Nullable public static org.apache.flink.table.data.utils.CastExecutor<?,?> create(CastRule.Context context, org.apache.flink.table.types.logical.LogicalType inputLogicalType, org.apache.flink.table.types.logical.LogicalType targetLogicalType) Create aCastExecutorfor the provided input type and target type. Returnsnullif no rule can be resolved. -
generateCodeBlock
@Nullable public static CastCodeBlock generateCodeBlock(CodeGeneratorCastRule.Context context, String inputTerm, String inputIsNullTerm, org.apache.flink.table.types.logical.LogicalType inputLogicalType, org.apache.flink.table.types.logical.LogicalType targetLogicalType) Create aCastCodeBlockfor the provided input type and target type. Returnsnullif no rule can be resolved or the resolved rule is not instance ofCodeGeneratorCastRule. -
cast
@Nullable public static Object cast(CastRule.Context context, org.apache.flink.table.types.logical.LogicalType inputLogicalType, org.apache.flink.table.types.logical.LogicalType targetLogicalType, Object value) Create aCastExecutorand execute the cast on the providedvalue. Fails withIllegalArgumentExceptionif the rule cannot be resolved, or with an exception from theCastExecutoritself if the rule can fail.
-