Class CastRulePredicate

java.lang.Object
org.apache.flink.table.planner.functions.casting.CastRulePredicate

@Internal public class CastRulePredicate extends Object
In order to apply a 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:
  1. getTargetTypeRoots() includes the LogicalTypeRoot of target type and either
    1. getInputTypeRoots() includes the LogicalTypeRoot of input type or
    2. getInputTypeFamilies() includes one of the LogicalTypeFamily of input type
  2. Or getTargetTypeFamilies() includes one of the LogicalTypeFamily of target type and either
    1. getInputTypeRoots() includes the LogicalTypeRoot of input type or
    2. getInputTypeFamilies() includes one of the LogicalTypeFamily of input type
  3. Or, if 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.

  • Method Details

    • getTargetTypes

      public Set<org.apache.flink.table.types.logical.LogicalType> getTargetTypes()
    • getInputTypeRoots

      public Set<org.apache.flink.table.types.logical.LogicalTypeRoot> getInputTypeRoots()
    • getTargetTypeRoots

      public Set<org.apache.flink.table.types.logical.LogicalTypeRoot> getTargetTypeRoots()
    • getInputTypeFamilies

      public Set<org.apache.flink.table.types.logical.LogicalTypeFamily> getInputTypeFamilies()
    • getTargetTypeFamilies

      public Set<org.apache.flink.table.types.logical.LogicalTypeFamily> getTargetTypeFamilies()
    • getCustomPredicate

      public Optional<BiPredicate<org.apache.flink.table.types.logical.LogicalType,org.apache.flink.table.types.logical.LogicalType>> getCustomPredicate()
    • builder

      public static CastRulePredicate.Builder builder()