Record Class AggregateSignature
java.lang.Object
java.lang.Record
com.darkcollective.relix.function.AggregateSignature
- Record Components:
name- the canonical spelling; matching is case-insensitiveparameters- the declared parameters, in order. Most aggregates take one value per row, but not all: a "row with the maximum" reduction takes the ranking expression and the one to yield from itarity- how many arguments a call may passreturnType- the declared result type. ATyperather than aScalarType, because a reduction can produce a nested value: one that gathers a group's values yields an array of whatever it gathered. SeeAggregateFunction.returnTypeFor(List)for a result type that follows the argument typesproperties- the optimizer contracts this aggregate honoursskipsNulls- whether a row is ignored when any of its argument values is NULL. True for the SQL reducers; false for one that gathers values into an array, where a NULL is part of the group's contents, and false for one whose NULL rule is its own — a "row with the maximum" reduction skips a NULL rank but yields whatever the winning row holds, NULL includedcategory- the grouping a function index lists it underdocKey- the key of this aggregate's documentation page, when it has one
public record AggregateSignature(String name, List<ParameterDefinition> parameters, Arity arity, Type returnType, Set<AggregateProperty> properties, boolean skipsNulls, String category, Optional<String> docKey)
extends Record
The form of an aggregate — what the engine needs to plan a grouping before any row
is read.
It is the scalar FunctionSignature with two additions that only a
reduction has. skipsNulls() states the SQL rule once instead of at every
site that has to honour it: an aggregate that skips NULLs counts values rather than
rows, and yields NULL for a group with no non-NULL value. properties()
carries what the optimizer may conclude — that a duplicate-removing step below this
aggregate is redundant, say.
-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionAggregateSignature(String name, List<ParameterDefinition> parameters, Arity arity, Type returnType, Set<AggregateProperty> properties, boolean skipsNulls, String category, Optional<String> docKey) Creates an instance of aAggregateSignaturerecord 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(AggregateProperty property) final inthashCode()Returns a hash code value for this object.name()Returns the value of thenamerecord component.static AggregateSignatureof(String name, Type returnType, Set<AggregateProperty> properties, ParameterDefinition... parameters) A NULL-skipping aggregate whose arity is exactly its parameter list, filed under the default category with no documentation key.Returns the value of theparametersrecord component.Returns the value of thepropertiesrecord component.Returns the value of thereturnTyperecord component.returnTypeFor(List<Type> argumentTypes) The declared result type, whatever the arguments are — seeAggregateFunction.returnTypeFor(List)for the overridable rule.booleanReturns the value of theskipsNullsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
AGGREGATE
The category an aggregate falls into when it declares none.- See Also:
-
-
Constructor Details
-
AggregateSignature
public AggregateSignature(String name, List<ParameterDefinition> parameters, Arity arity, Type returnType, Set<AggregateProperty> properties, boolean skipsNulls, String category, Optional<String> docKey) Creates an instance of aAggregateSignaturerecord 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 componentskipsNulls- the value for theskipsNullsrecord componentcategory- the value for thecategoryrecord componentdocKey- the value for thedocKeyrecord component
-
-
Method Details
-
of
public static AggregateSignature of(String name, Type returnType, Set<AggregateProperty> properties, ParameterDefinition... parameters) A NULL-skipping aggregate whose arity is exactly its parameter list, filed under the default category with no documentation key.- Parameters:
name- the canonical spellingreturnType- the declared result typeproperties- the optimizer contracts this aggregate honoursparameters- the declared parameters, in order- Returns:
- the signature
-
canonicalName
The key this signature is indexed and looked up under: the name, lower-cased.- Returns:
- the lower-cased name
-
returnTypeFor
The declared result type, whatever the arguments are — seeAggregateFunction.returnTypeFor(List)for the overridable rule.- Parameters:
argumentTypes- the argument types at a call site, in order- Returns:
returnType()
-
has
- Parameters:
property- the property to test- Returns:
truewhen this aggregate 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. Reference components are compared withObjects::equals(Object,Object); primitive components are compared with '=='. -
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
-
skipsNulls
public boolean skipsNulls()Returns the value of theskipsNullsrecord component.- Returns:
- the value of the
skipsNullsrecord 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
-