Class ComparableTypeStrategy
java.lang.Object
org.apache.flink.table.types.inference.strategies.ComparableTypeStrategy
- All Implemented Interfaces:
InputTypeStrategy
An
InputTypeStrategy that checks if all input arguments can be compared with each other
with the minimal provided comparison.
It requires at least one argument. In case of one argument, the argument must be comparable with itself (e.g. for aggregations).
For the rules which types are comparable with which types see LogicalTypeChecks.areComparable(LogicalType, LogicalType, StructuredComparison).
-
Constructor Summary
ConstructorsConstructorDescriptionComparableTypeStrategy(ConstantArgumentCount argumentCount, StructuredType.StructuredComparison requiredComparison) -
Method Summary
Modifier and TypeMethodDescriptionInitial input validation based on the number of arguments.getExpectedSignatures(FunctionDefinition definition) Returns a summary of the function's expected signatures.inferInputTypes(CallContext callContext, boolean throwOnFailure) Main logic for inferring and validating the input arguments.
-
Constructor Details
-
ComparableTypeStrategy
public ComparableTypeStrategy(ConstantArgumentCount argumentCount, StructuredType.StructuredComparison requiredComparison)
-
-
Method Details
-
getArgumentCount
Description copied from interface:InputTypeStrategyInitial input validation based on the number of arguments.- Specified by:
getArgumentCountin interfaceInputTypeStrategy
-
inferInputTypes
Description copied from interface:InputTypeStrategyMain logic for inferring and validating the input arguments. Returns a list of argument data types that are valid for the given call. If the returned types differ fromCallContext.getArgumentDataTypes(), a casting operation can be inserted. An empty result means that the given input is invalid.- Specified by:
inferInputTypesin interfaceInputTypeStrategy- Parameters:
callContext- provides details about the function callthrowOnFailure- whether this function is allowed to throw anValidationExceptionwith a meaningful exception in case the inference is not successful or if this function should simply return an empty result.- Returns:
- three-state result for either "true, same data types as arguments", "true, but arguments must be casted to returned data types", or "false, no inferred data types could be found"
- See Also:
-
getExpectedSignatures
Description copied from interface:InputTypeStrategyReturns a summary of the function's expected signatures.- Specified by:
getExpectedSignaturesin interfaceInputTypeStrategy- Parameters:
definition- the function definition that defines the function currently being called.
-