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:
TypeStrategy
-
-
Field Summary
Fields Modifier and Type Field Description static TypeStrategy
COMMON
Type strategy that returns a common, least restrictive type of all arguments.static TypeStrategy
MISSING
Placeholder for a missing type strategy.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description 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.static TypeStrategy
argument(int pos)
Type strategy that returns the n-th input argument.static TypeStrategy
argument(int pos, Function<DataType,Optional<DataType>> mapper)
Type strategy that returns the n-th input argument, mapping it.static TypeStrategy
commonRange(ArgumentCount argumentRange)
Type strategy that returns a common, least restrictive type of selected arguments.static TypeStrategy
explicit(DataType dataType)
Type strategy that returns a fixedDataType
.static TypeStrategy
first(TypeStrategy... strategies)
Type strategy that returns the first type that could be inferred.static TypeStrategy
forceNullable(TypeStrategy initialStrategy)
Type strategy which forces the given {@param initialStrategy} to be nullable.static TypeStrategy
mapping(Map<InputTypeStrategy,TypeStrategy> mappings)
Type strategy that maps anInputTypeStrategy
to aTypeStrategy
if the input strategy infers identical types.static TypeStrategy
matchFamily(int argumentPos, LogicalTypeFamily family)
Type strategy that returns the given argument if it is of the same logical type family.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.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.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.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.static TypeStrategy
varyingString(TypeStrategy initialStrategy)
A type strategy that ensures that the result type is eitherLogicalTypeRoot.VARCHAR
orLogicalTypeRoot.VARBINARY
from their corresponding non-varying roots.
-
-
-
Field Detail
-
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 Detail
-
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 fixedDataType
.
-
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 anInputTypeStrategy
to aTypeStrategy
if the input strategy infers identical types.
-
forceNullable
public static TypeStrategy forceNullable(TypeStrategy initialStrategy)
Type strategy which forces the given {@param initialStrategy} 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 eitherLogicalTypeRoot.VARCHAR
orLogicalTypeRoot.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.
-
-