Record Class FunctionSignature
- Record Components:
name- the canonical spelling, as it should appear in documentation and diagnostics; matching is case-insensitive, so this is the display form rather than a keyparameters- the declared parameters, in order. A function whose arity range is wider than this list — a variadicCoalesce, an optional trailing argument — declares the parameters it can name, and the range inaritygoverns what a call may passarity- how many arguments a call may passreturnType- the declared result type; seeScalarFunction.returnTypeFor(List)for a result type that depends on the argument typesproperties- the optimizer contracts this function honourscategory- the grouping a function index lists it under —"string","math","datetime"docKey- the key of this function's documentation page, when it has one
Analysis, validation, optimisation and pushdown planning all run against this
record and never against the implementation behind it. Sin and Cos
are the same form; what separates them is the lambda, and the lambda is of no
interest to a phase that is checking argument counts or deciding whether a call can
be folded.
The property set is a contract with the optimizer, not a description:
FunctionProperty.PURE permits hoisting and common-subexpression
elimination, and declaring it of a function that reads the clock or an RNG produces
wrong answers rather than slow ones. Declare conservatively.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe category a function falls into when it declares none. -
Constructor Summary
ConstructorsConstructorDescriptionFunctionSignature(String name, List<ParameterDefinition> parameters, Arity arity, ScalarType returnType, Set<FunctionProperty> properties, String category, Optional<String> docKey) Creates an instance of aFunctionSignaturerecord class. -
Method Summary
Modifier and TypeMethodDescriptionarity()Returns the value of thearityrecord component.The key this signature is indexed and looked up under: the name, lower-cased.category()Returns the value of thecategoryrecord component.docKey()Returns the value of thedocKeyrecord component.final booleanIndicates whether some other object is "equal to" this one.booleanhas(FunctionProperty property) final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.static FunctionSignatureof(String name, ScalarType returnType, String category, Set<FunctionProperty> properties, ParameterDefinition... parameters) A signature whose arity is exactly its parameter list, with no documentation key.Returns the value of theparametersrecord component.Returns the value of thepropertiesrecord component.Returns the value of thereturnTyperecord component.returnTypeFor(List<ScalarType> argumentTypes) The declared result type, whatever the arguments are.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
UNCATEGORISED
The category a function falls into when it declares none.- See Also:
-
-
Constructor Details
-
FunctionSignature
public FunctionSignature(String name, List<ParameterDefinition> parameters, Arity arity, ScalarType returnType, Set<FunctionProperty> properties, String category, Optional<String> docKey) Creates an instance of aFunctionSignaturerecord class.- Parameters:
name- the value for thenamerecord componentparameters- the value for theparametersrecord componentarity- the value for thearityrecord componentreturnType- the value for thereturnTyperecord componentproperties- the value for thepropertiesrecord componentcategory- the value for thecategoryrecord componentdocKey- the value for thedocKeyrecord component
-
-
Method Details
-
of
public static FunctionSignature of(String name, ScalarType returnType, String category, Set<FunctionProperty> properties, ParameterDefinition... parameters) A signature whose arity is exactly its parameter list, with no documentation key.- Parameters:
name- the canonical spellingreturnType- the declared result typecategory- the grouping a function index lists it underproperties- the optimizer contracts this function honoursparameters- the declared parameters, in order- Returns:
- the signature
-
canonicalName
The key this signature is indexed and looked up under: the name, lower-cased. Names are matched case-insensitively, soUCase,ucaseandUCASEare one function.- Returns:
- the lower-cased name
-
returnTypeFor
The declared result type, whatever the arguments are.This is the answer for every function whose result type is fixed, which is nearly all of them. A function whose result follows its arguments — a conditional returning whichever branch it selects — states that rule by overriding
ScalarFunction.returnTypeFor(List), which delegates here unless it is overridden.- Parameters:
argumentTypes- the argument types at a call site, in order- Returns:
returnType()
-
has
- Parameters:
property- the property to test- Returns:
truewhen this function declaresproperty
-
toString
Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components. -
hashCode
public final int hashCode()Returns a hash code value for this object. The value is derived from the hash code of each of the record components. -
equals
Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared withObjects::equals(Object,Object). -
name
Returns the value of thenamerecord component.- Returns:
- the value of the
namerecord component
-
parameters
Returns the value of theparametersrecord component.- Returns:
- the value of the
parametersrecord component
-
arity
Returns the value of thearityrecord component.- Returns:
- the value of the
arityrecord component
-
returnType
Returns the value of thereturnTyperecord component.- Returns:
- the value of the
returnTyperecord component
-
properties
Returns the value of thepropertiesrecord component.- Returns:
- the value of the
propertiesrecord component
-
category
Returns the value of thecategoryrecord component.- Returns:
- the value of the
categoryrecord component
-
docKey
Returns the value of thedocKeyrecord component.- Returns:
- the value of the
docKeyrecord component
-