Class TypeStrategies

java.lang.Object
org.apache.flink.table.types.inference.TypeStrategies

@Internal public final class TypeStrategies extends Object
Strategies for inferring an output or accumulator data type of a function call.
See Also:
  • Field Details

    • MISSING

      public static final TypeStrategy MISSING
      Placeholder for a missing type strategy.
    • COMMON

      public static final TypeStrategy COMMON
      Type strategy that returns a common, least restrictive type of all arguments.
  • Method Details

    • commonRange

      public static TypeStrategy commonRange(ArgumentCount argumentRange)
      Type strategy that returns a common, least restrictive type of selected arguments.
    • explicit

      public static TypeStrategy explicit(DataType dataType)
      Type strategy that returns a fixed DataType.
    • argument

      public static TypeStrategy argument(int pos)
      Type strategy that returns the n-th input argument.
    • argument

      public static TypeStrategy argument(int pos, Function<DataType,Optional<DataType>> mapper)
      Type strategy that returns the n-th input argument, mapping it.
    • first

      public static TypeStrategy first(TypeStrategy... strategies)
      Type strategy that returns the first type that could be inferred.
    • matchFamily

      public static TypeStrategy matchFamily(int argumentPos, LogicalTypeFamily family)
      Type strategy that returns the given argument if it is of the same logical type family.
    • mapping

      public static TypeStrategy mapping(Map<InputTypeStrategy,TypeStrategy> mappings)
      Type strategy that maps an InputTypeStrategy to a TypeStrategy if the input strategy infers identical types.
    • forceNullable

      public static TypeStrategy forceNullable(TypeStrategy initialStrategy)
      Type strategy which forces the given to be nullable.
    • nullableIfArgs

      public static TypeStrategy nullableIfArgs(ConstantArgumentCount includedArgs, TypeStrategy initialStrategy)
      A type strategy that can be used to make a result type nullable if any of the selected input arguments is nullable. Otherwise the type will be not null.
    • nullableIfArgs

      public static TypeStrategy nullableIfArgs(TypeStrategy initialStrategy)
      A type strategy that can be used to make a result type nullable if any of the input arguments is nullable. Otherwise the type will be not null.
    • nullableIfAllArgs

      public static TypeStrategy nullableIfAllArgs(ConstantArgumentCount includedArgs, TypeStrategy initialStrategy)
      A type strategy that can be used to make a result type nullable if all the selected input arguments are nullable. Otherwise the type will be non-nullable.
    • nullableIfAllArgs

      public static TypeStrategy nullableIfAllArgs(TypeStrategy initialStrategy)
      A type strategy that can be used to make a result type nullable if all the input arguments is nullable. Otherwise the type will be not null.
    • varyingString

      public static TypeStrategy varyingString(TypeStrategy initialStrategy)
      A type strategy that ensures that the result type is either LogicalTypeRoot.VARCHAR or LogicalTypeRoot.VARBINARY from their corresponding non-varying roots.
    • aggArg0

      public static TypeStrategy aggArg0(Function<LogicalType,LogicalType> aggType, boolean nullableIfGroupingEmpty)
      Type strategy specific for aggregations that partially produce different nullability depending whether the result is grouped or not.