Constructor and Description |
---|
CastRuleProvider() |
Modifier and Type | Method and Description |
---|---|
static boolean |
canFail(LogicalType inputType,
LogicalType targetType)
Resolves the rule and returns the result of
CastRule.canFail(LogicalType,
LogicalType) . |
static Object |
cast(CastRule.Context context,
LogicalType inputLogicalType,
LogicalType targetLogicalType,
Object value)
Create a
CastExecutor and execute the cast on the provided value . |
static CastExecutor<?,?> |
create(CastRule.Context context,
LogicalType inputLogicalType,
LogicalType targetLogicalType)
Create a
CastExecutor for the provided input type and target type. |
static boolean |
exists(LogicalType inputType,
LogicalType targetType)
Returns
true if and only if a CastRule 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 a
CastCodeBlock for the provided input type and target type. |
static CastRule<?,?> |
resolve(LogicalType inputType,
LogicalType targetType)
Resolve a
CastRule for the provided input type and target type. |
@Nullable public static CastRule<?,?> resolve(LogicalType inputType, LogicalType targetType)
CastRule
for the provided input type and target type. Returns null
if no rule can be resolved.public static boolean exists(LogicalType inputType, LogicalType targetType)
true
if and only if a CastRule
can be resolved for the provided input
type and target type.public static boolean canFail(LogicalType inputType, LogicalType targetType)
CastRule.canFail(LogicalType,
LogicalType)
. Fails with NullPointerException
if the rule cannot be resolved.@Nullable public static CastExecutor<?,?> create(CastRule.Context context, LogicalType inputLogicalType, LogicalType targetLogicalType)
CastExecutor
for the provided input type and target type. Returns null
if no rule can be resolved.@Nullable public static CastCodeBlock generateCodeBlock(CodeGeneratorCastRule.Context context, String inputTerm, String inputIsNullTerm, LogicalType inputLogicalType, LogicalType targetLogicalType)
CastCodeBlock
for the provided input type and target type. Returns null
if no rule can be resolved or the resolved rule is not instance of CodeGeneratorCastRule
.@Nullable public static Object cast(CastRule.Context context, LogicalType inputLogicalType, LogicalType targetLogicalType, Object value)
CastExecutor
and execute the cast on the provided value
. Fails with
IllegalArgumentException
if the rule cannot be resolved, or with an exception from
the CastExecutor
itself if the rule can fail.Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.