Interface CallContext
-
- All Known Implementing Classes:
CastCallContext,UnknownCallContext
@PublicEvolving public interface CallContextProvides details about a function call duringTypeInference.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default <T> Optional<T>fail(boolean throwOnFailure, String message, Object... args)Helper method for handling failures during the type inference process while considering thethrowOnFailureflag.List<DataType>getArgumentDataTypes()Returns a resolved list of the call's argument types.<T> Optional<T>getArgumentValue(int pos, Class<T> clazz)Returns the literal value of the argument at the given position, given that the argument is a literal, is not null, and can be expressed as an instance of the provided class.DataTypeFactorygetDataTypeFactory()Enables to lookup types in a catalog and resolve RAW types.FunctionDefinitiongetFunctionDefinition()Returns the function definition that defines the function currently being called.StringgetName()Returns the function's name usually referencing the function in a catalog.default Optional<ChangelogMode>getOutputChangelogMode()Returns theChangelogModethat the framework requires from the function.Optional<DataType>getOutputDataType()Returns the inferred output data type of the function call.default Optional<TableSemantics>getTableSemantics(int pos)Returns information about the table that has been passed to a table argument.booleanisArgumentLiteral(int pos)Returns whether the argument at the given position is a value literal.booleanisArgumentNull(int pos)Returnstrueif the argument at the given position is a literal andnull,falseotherwise.booleanisGroupedAggregation()Returns whether the function call happens as part of an aggregation that defines grouping columns.default ValidationExceptionnewValidationError(String message, Object... args)Creates a validation exception for exiting the type inference process with a meaningful exception.
-
-
-
Method Detail
-
getDataTypeFactory
DataTypeFactory getDataTypeFactory()
Enables to lookup types in a catalog and resolve RAW types.
-
getFunctionDefinition
FunctionDefinition getFunctionDefinition()
Returns the function definition that defines the function currently being called.
-
isArgumentLiteral
boolean isArgumentLiteral(int pos)
Returns whether the argument at the given position is a value literal.
-
isArgumentNull
boolean isArgumentNull(int pos)
Returnstrueif the argument at the given position is a literal andnull,falseotherwise. If the argument is declared as optional and has no value, true is returned.Use
isArgumentLiteral(int)before to check if the argument is actually a literal.
-
getArgumentValue
<T> Optional<T> getArgumentValue(int pos, Class<T> clazz)
Returns the literal value of the argument at the given position, given that the argument is a literal, is not null, and can be expressed as an instance of the provided class.It supports conversions to default conversion classes of
LogicalTypes. This method should not be called with other classes.Use
isArgumentLiteral(int)before to check if the argument is actually a literal.
-
getTableSemantics
default Optional<TableSemantics> getTableSemantics(int pos)
Returns information about the table that has been passed to a table argument.This method applies only to
ProcessTableFunctions.Semantics are only available for table arguments that are annotated with
@ArgumentHint(SET_SEMANTIC_TABLE)or@ArgumentHint(ROW_SEMANTIC_TABLE)).
-
getOutputChangelogMode
default Optional<ChangelogMode> getOutputChangelogMode()
Returns theChangelogModethat the framework requires from the function.This method applies only to
ProcessTableFunction.Returns empty during type inference phase as the changelog mode is still unknown. Returns an actual changelog mode, when the PTF implements the
ChangelogFunctioninterface.
-
getName
String getName()
Returns the function's name usually referencing the function in a catalog.Note: The name is meant for debugging purposes only.
-
getArgumentDataTypes
List<DataType> getArgumentDataTypes()
Returns a resolved list of the call's argument types. It also includes a type for every argument in a vararg function call.
-
getOutputDataType
Optional<DataType> getOutputDataType()
Returns the inferred output data type of the function call.It does this by inferring the input argument data type using
ArgumentTypeStrategy.inferArgumentType(CallContext, int, boolean)of a wrapping call (if available) where this function call is an argument. For example,takes_string(this_function(NULL))would lead to aDataTypes.STRING()because the wrapping call expects a string argument.
-
newValidationError
default ValidationException newValidationError(String message, Object... args)
Creates a validation exception for exiting the type inference process with a meaningful exception.
-
fail
default <T> Optional<T> fail(boolean throwOnFailure, String message, Object... args)
Helper method for handling failures during the type inference process while considering thethrowOnFailureflag.Shorthand for
if (throwOnFailure) throw ValidationException(...) else return Optional.empty().
-
isGroupedAggregation
boolean isGroupedAggregation()
Returns whether the function call happens as part of an aggregation that defines grouping columns.E.g.
SELECT COUNT(*) FROM tis not a grouped aggregation butSELECT COUNT(*) FROM t GROUP BY kis.
-
-