@Internal public class CastRulePredicate extends Object
CastRule
, the runtime checks if a particular rule matches the tuple
of input and target type using this class. In particular, a rule is applied if:
getTargetTypeRoots()
includes the LogicalTypeRoot
of target type and
either
getInputTypeRoots()
includes the LogicalTypeRoot
of input type or
getInputTypeFamilies()
includes one of the LogicalTypeFamily
of
input type
getTargetTypeFamilies()
includes one of the LogicalTypeFamily
of target
type and either
getInputTypeRoots()
includes the LogicalTypeRoot
of input type or
getInputTypeFamilies()
includes one of the LogicalTypeFamily
of
input type
getCustomPredicate()
is not null, the input LogicalType
and target
LogicalType
matches the predicate.
The customPredicate
should be used in cases where LogicalTypeRoot
and LogicalTypeFamily
are not enough to identify whether a rule is applicable or not, for example
when the matching depends on a field of the provided input LogicalType
instance.
Modifier and Type | Class and Description |
---|---|
static class |
CastRulePredicate.Builder
Builder for the
CastRulePredicate . |
Modifier and Type | Method and Description |
---|---|
static CastRulePredicate.Builder |
builder() |
Optional<BiPredicate<LogicalType,LogicalType>> |
getCustomPredicate() |
Set<LogicalTypeFamily> |
getInputTypeFamilies() |
Set<LogicalTypeRoot> |
getInputTypeRoots() |
Set<LogicalTypeFamily> |
getTargetTypeFamilies() |
Set<LogicalTypeRoot> |
getTargetTypeRoots() |
Set<LogicalType> |
getTargetTypes() |
public Set<LogicalType> getTargetTypes()
public Set<LogicalTypeRoot> getInputTypeRoots()
public Set<LogicalTypeRoot> getTargetTypeRoots()
public Set<LogicalTypeFamily> getInputTypeFamilies()
public Set<LogicalTypeFamily> getTargetTypeFamilies()
public Optional<BiPredicate<LogicalType,LogicalType>> getCustomPredicate()
public static CastRulePredicate.Builder builder()
Copyright © 2014–2024 The Apache Software Foundation. All rights reserved.