@Internal public final class TypeInferenceUtil extends Object
The following steps summarize the envisioned type inference process. Not all features are implemented or exposed through the API yet (*).
CallContext
.
takes_string(this_function(NULL))
infer operands from takes_string(NULL)
and use
the inferred string type as the return type of this_function(NULL)
.
Modifier and Type | Class and Description |
---|---|
static class |
TypeInferenceUtil.Result
The result of a type inference run.
|
static class |
TypeInferenceUtil.SurroundingInfo
Information what the outer world (i.e.
|
Modifier and Type | Method and Description |
---|---|
static CallContext |
adaptArguments(TypeInference typeInference,
CallContext callContext,
DataType outputType)
Adapts the call's argument if necessary.
|
static ValidationException |
createInvalidCallException(CallContext callContext,
ValidationException cause)
Returns an exception for an invalid call to a function.
|
static ValidationException |
createInvalidInputException(TypeInference typeInference,
CallContext callContext,
ValidationException cause)
Returns an exception for invalid input arguments.
|
static TableException |
createUnexpectedException(CallContext callContext,
Throwable cause)
Returns an exception for an unexpected error during type inference.
|
static String |
generateSignature(TypeInference typeInference,
String name,
FunctionDefinition definition)
Generates a signature of the given
FunctionDefinition . |
static DataType |
inferOutputType(CallContext callContext,
TypeStrategy outputTypeStrategy)
Infers an output type using the given
TypeStrategy . |
static TypeInferenceUtil.Result |
runTypeInference(TypeInference typeInference,
CallContext callContext,
TypeInferenceUtil.SurroundingInfo surroundingInfo)
Runs the entire type inference process.
|
public static TypeInferenceUtil.Result runTypeInference(TypeInference typeInference, CallContext callContext, @Nullable TypeInferenceUtil.SurroundingInfo surroundingInfo)
typeInference
- type inference of the current callcallContext
- call context of the current callsurroundingInfo
- information about the outer wrapping call of a current function call
for performing input type inferencepublic static CallContext adaptArguments(TypeInference typeInference, CallContext callContext, @Nullable DataType outputType)
This includes casts that need to be inserted, reordering of arguments (*), or insertion of default values (*) where (*) is future work.
public static DataType inferOutputType(CallContext callContext, TypeStrategy outputTypeStrategy)
TypeStrategy
. It assumes that input arguments
have been adapted before if necessary.public static String generateSignature(TypeInference typeInference, String name, FunctionDefinition definition)
FunctionDefinition
.public static ValidationException createInvalidInputException(TypeInference typeInference, CallContext callContext, ValidationException cause)
public static ValidationException createInvalidCallException(CallContext callContext, ValidationException cause)
public static TableException createUnexpectedException(CallContext callContext, Throwable cause)
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.