@Internal public final class InputTypeStrategies extends Object
InputTypeStrategy
,
ArgumentTypeStrategy
Modifier and Type | Field and Description |
---|---|
static AnyArgumentTypeStrategy |
ANY
Strategy for an argument that can be of any type.
|
static LiteralArgumentTypeStrategy |
LITERAL
Strategy that checks if an argument is a literal.
|
static LiteralArgumentTypeStrategy |
LITERAL_OR_NULL
Strategy that checks if an argument is a literal or NULL.
|
static OutputArgumentTypeStrategy |
OUTPUT_IF_NULL
Strategy for inferring an unknown argument type from the function's output
DataType
if available. |
static InputTypeStrategy |
SPECIFIC_FOR_ARRAY
Strategy specific for
BuiltInFunctionDefinitions.ARRAY . |
static InputTypeStrategy |
SPECIFIC_FOR_MAP
Strategy specific for
BuiltInFunctionDefinitions.MAP . |
static WildcardInputTypeStrategy |
WILDCARD
Strategy that does not perform any modification or validation of the input.
|
Modifier and Type | Method and Description |
---|---|
static AndArgumentTypeStrategy |
and(ArgumentTypeStrategy... strategies)
Strategy for a conjunction of multiple
ArgumentTypeStrategy s into one like f(NUMERIC && LITERAL) . |
static ExplicitArgumentTypeStrategy |
explicit(DataType expectedDataType)
Strategy for an argument that corresponds to an explicitly defined type casting.
|
static InputTypeStrategy |
explicitSequence(DataType... expectedDataTypes)
Strategy for a function signature of explicitly defined types like
f(STRING, INT) . |
static InputTypeStrategy |
explicitSequence(String[] argumentNames,
DataType[] expectedDataTypes)
Strategy for a named function signature of explicitly defined types like
f(s STRING, i
INT) . |
static FamilyArgumentTypeStrategy |
logical(LogicalTypeFamily expectedFamily)
Strategy for an argument that corresponds to a given
LogicalTypeFamily . |
static FamilyArgumentTypeStrategy |
logical(LogicalTypeFamily expectedFamily,
boolean expectedNullability)
Strategy for an argument that corresponds to a given
LogicalTypeFamily and
nullability. |
static RootArgumentTypeStrategy |
logical(LogicalTypeRoot expectedRoot)
Strategy for an argument that corresponds to a given
LogicalTypeRoot . |
static RootArgumentTypeStrategy |
logical(LogicalTypeRoot expectedRoot,
boolean expectedNullability)
Strategy for an argument that corresponds to a given
LogicalTypeRoot and nullability. |
static OrArgumentTypeStrategy |
or(ArgumentTypeStrategy... strategies)
Strategy for a disjunction of multiple
ArgumentTypeStrategy s into one like f(NUMERIC || STRING) . |
static InputTypeStrategy |
or(InputTypeStrategy... strategies)
Strategy for a disjunction of multiple
InputTypeStrategy s into one like f(NUMERIC) || f(STRING) . |
static InputTypeStrategy |
sequence(ArgumentTypeStrategy... strategies)
Strategy for a function signature like
f(STRING, NUMERIC) using a sequence of ArgumentTypeStrategy s. |
static InputTypeStrategy |
sequence(String[] argumentNames,
ArgumentTypeStrategy[] strategies)
Strategy for a named function signature like
f(s STRING, n NUMERIC) using a sequence
of ArgumentTypeStrategy s. |
static InputTypeStrategy |
varyingSequence(ArgumentTypeStrategy... strategies)
Strategy for a varying function signature like
f(INT, STRING, NUMERIC...) using a
sequence of ArgumentTypeStrategy s. |
static InputTypeStrategy |
varyingSequence(String[] argumentNames,
ArgumentTypeStrategy[] strategies)
Strategy for a varying named function signature like
f(i INT, str STRING, num
NUMERIC...) using a sequence of ArgumentTypeStrategy s. |
static InputTypeStrategy |
wildcardWithCount(ArgumentCount argumentCount)
Strategy that does not perform any modification or validation of the input.
|
public static final WildcardInputTypeStrategy WILDCARD
public static final OutputArgumentTypeStrategy OUTPUT_IF_NULL
DataType
if available.public static final AnyArgumentTypeStrategy ANY
public static final LiteralArgumentTypeStrategy LITERAL
public static final LiteralArgumentTypeStrategy LITERAL_OR_NULL
public static final InputTypeStrategy SPECIFIC_FOR_ARRAY
BuiltInFunctionDefinitions.ARRAY
.
It expects at least one argument. All the arguments must have a common super type.
public static final InputTypeStrategy SPECIFIC_FOR_MAP
BuiltInFunctionDefinitions.MAP
.
It expects at least two arguments. There must be even number of arguments. All the keys and values must have a common super type respectively.
public static InputTypeStrategy sequence(ArgumentTypeStrategy... strategies)
f(STRING, NUMERIC)
using a sequence of ArgumentTypeStrategy
s.public static InputTypeStrategy sequence(String[] argumentNames, ArgumentTypeStrategy[] strategies)
f(s STRING, n NUMERIC)
using a sequence
of ArgumentTypeStrategy
s.public static InputTypeStrategy varyingSequence(ArgumentTypeStrategy... strategies)
f(INT, STRING, NUMERIC...)
using a
sequence of ArgumentTypeStrategy
s. The first n - 1 arguments must be constant. The
n-th argument can occur 0, 1, or more times.public static InputTypeStrategy varyingSequence(String[] argumentNames, ArgumentTypeStrategy[] strategies)
f(i INT, str STRING, num
NUMERIC...)
using a sequence of ArgumentTypeStrategy
s. The first n - 1 arguments
must be constant. The n-th argument can occur 0, 1, or more times.public static InputTypeStrategy explicitSequence(DataType... expectedDataTypes)
f(STRING, INT)
.
Implicit casts will be inserted if possible.
This is equivalent to using sequence(ArgumentTypeStrategy...)
and explicit(DataType)
.
public static InputTypeStrategy explicitSequence(String[] argumentNames, DataType[] expectedDataTypes)
f(s STRING, i
INT)
. Implicit casts will be inserted if possible.
This is equivalent to using sequence(String[], ArgumentTypeStrategy[])
and explicit(DataType)
.
public static InputTypeStrategy or(InputTypeStrategy... strategies)
InputTypeStrategy
s into one like f(NUMERIC) || f(STRING)
.
This strategy aims to infer a list of types that are equal to the input types (to prevent unnecessary casting) or (if this is not possible) the first more specific, casted types.
public static InputTypeStrategy wildcardWithCount(ArgumentCount argumentCount)
public static ExplicitArgumentTypeStrategy explicit(DataType expectedDataType)
public static RootArgumentTypeStrategy logical(LogicalTypeRoot expectedRoot)
LogicalTypeRoot
. Implicit casts
will be inserted if possible.public static RootArgumentTypeStrategy logical(LogicalTypeRoot expectedRoot, boolean expectedNullability)
LogicalTypeRoot
and nullability.
Implicit casts will be inserted if possible.public static FamilyArgumentTypeStrategy logical(LogicalTypeFamily expectedFamily)
LogicalTypeFamily
. Implicit
casts will be inserted if possible.public static FamilyArgumentTypeStrategy logical(LogicalTypeFamily expectedFamily, boolean expectedNullability)
LogicalTypeFamily
and
nullability. Implicit casts will be inserted if possible.public static AndArgumentTypeStrategy and(ArgumentTypeStrategy... strategies)
ArgumentTypeStrategy
s into one like f(NUMERIC && LITERAL)
.
Some ArgumentTypeStrategy
s cannot contribute an inferred type that is different
from the input type (e.g. LITERAL
). Therefore, the order f(X && Y)
or f(Y && X)
matters as it defines the precedence in case the result must be casted to a more
specific type.
This strategy aims to infer the first more specific, casted type or (if this is not
possible) a type that has been inferred from all ArgumentTypeStrategy
s.
public static OrArgumentTypeStrategy or(ArgumentTypeStrategy... strategies)
ArgumentTypeStrategy
s into one like f(NUMERIC || STRING)
.
Some ArgumentTypeStrategy
s cannot contribute an inferred type that is different
from the input type (e.g. LITERAL
). Therefore, the order f(X || Y)
or f(Y || X)
matters as it defines the precedence in case the result must be casted to a more
specific type.
This strategy aims to infer a type that is equal to the input type (to prevent unnecessary casting) or (if this is not possible) the first more specific, casted type.
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.