public class COUNT extends AggregateBase<IV>
Note: COUNT(*) is the cardinality of the solution multiset. COUNT(DISTINCT *) is the cardinality of the distinct solutions in the solution multiset. These semantics are not directly handled by this class. It relies on the aggregation operator to compute those values.
AggregateBase.Annotations
EMPTY_LITERAL, ZERO
DEFAULT_INITIAL_CAPACITY
Constructor and Description |
---|
COUNT(boolean distinct,
IValueExpression<IV> expr) |
COUNT(BOp[] args,
Map<String,Object> annotations) |
COUNT(COUNT op) |
Modifier and Type | Method and Description |
---|---|
IV |
done()
Return the final value.
|
IV |
get(IBindingSet bindingSet)
Return the current value of the aggregate (this has a side-effect on the
internal state of the
IAggregate operator). |
INeedsMaterialization.Requirement |
getRequirement()
COUNT does not need to actually see the materialized values, or even the
IVs.
|
void |
reset()
Reset the aggregate's internal state.
|
isDistinct, isWildcard
_clearProperty, _setProperty
__replaceArg, _set, annotations, annotationsCopy, annotationsEqual, annotationsRef, argIterator, args, argsCopy, arity, clearAnnotations, clearProperty, deepCopy, deepCopy, get, getProperty, setArg, setProperty, setUnboundProperty, toArray, toArray
annotationsEqual, annotationsToString, annotationsToString, annotationValueToString, checkArgs, clone, equals, getEvaluationContext, getId, getProperty, getRequiredProperty, hashCode, indent, isController, mutation, shortenName, toShortString, toString, toString
finalize, getClass, notify, notifyAll, wait, wait, wait
toString
annotations, argIterator, args, arity, clone, get, getEvaluationContext, getId, getProperty, getRequiredProperty, isController, setProperty, toArray, toArray, toShortString, toString
getProperty
public COUNT(COUNT op)
public COUNT(boolean distinct, IValueExpression<IV> expr)
public IV get(IBindingSet bindingSet)
IAggregate
operator). Functions which can
not produce an intermediate result, such as AVERAGE, MAY return
null
.
Note: If evaluation of the IAggregate
throws an error, then that
error must be "sticky" and reported out by IAggregate.done()
as well. This
contract is relied on to correctly propagate errors within a group when
using incremental (pipelined) evaluation of IAggregate
s. The
error state is cleared by IAggregate.reset()
.
Operation is not implemented by this class and must be overridden if the
AggregateBase
is to be directly evaluated. However, note that the
computation of aggregate functions is often based on hard coded
recognition of the appropriate function code.
Note: DISTINCT is merely carried as a marker on COUNT (and the other
aggregate functions). The application of DISTINCT to the inner expression
to form a column projection is handled by the driving evaluation logic
rather than by AggregateBase.get(IBindingSet)
.
Note: COUNT() returns ZERO if there are no non-error solutions presented. This assumes that the ZERO will be an xsd:long.
get
in interface IAggregate<IV>
get
in interface IValueExpression<IV>
get
in class AggregateBase<IV>
bindingSet
- The binding set.public void reset()
IAggregate
public IV done()
IAggregate
public INeedsMaterialization.Requirement getRequirement()
Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.