E
- public abstract class AggregateBase<E> extends ImmutableBOp implements IAggregate<E>
Modifier and Type | Class and Description |
---|---|
static interface |
AggregateBase.Annotations |
Modifier and Type | Field and Description |
---|---|
protected static org.openrdf.model.Literal |
EMPTY_LITERAL
An empty string.
|
protected static NumericIV |
ZERO
A ZERO.
|
DEFAULT_INITIAL_CAPACITY
Constructor and Description |
---|
AggregateBase(AggregateBase<E> op) |
AggregateBase(boolean distinct,
IValueExpression<E>... expr) |
AggregateBase(BOp[] args,
Map<String,Object> annotations)
Core shallow copy constructor.
|
Modifier and Type | Method and Description |
---|---|
E |
get(IBindingSet bset)
Return the current value of the aggregate (this has a side-effect on the
internal state of the
IAggregate operator). |
boolean |
isDistinct()
true if the aggregate is to be applied to the distinct
solutions within the group. |
boolean |
isWildcard()
Return
true iff the IValueExpression is the special
variable * (but note that this is only allowed for COUNT). |
_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
done, reset
toString
annotations, argIterator, args, arity, clone, get, getEvaluationContext, getId, getProperty, getRequiredProperty, isController, setProperty, toArray, toArray, toShortString, toString
getProperty
protected static final transient NumericIV ZERO
protected static final transient org.openrdf.model.Literal EMPTY_LITERAL
public AggregateBase(AggregateBase<E> op)
public AggregateBase(BOp[] args, Map<String,Object> annotations)
AggregateBase.Annotations.DISTINCT
. The expr is modeled as the
first argument for the aggregate function.args
- annotations
- public AggregateBase(boolean distinct, IValueExpression<E>... expr)
distinct
- true
iff the keyword DISTINCT was used, for
example COUNT(DISTINCT y)
expr
- The value expression to be computed, for example
x
in COUNT(DISTINCT x)
or
y+x
in MIN(x+y)
. Note that only
COUNT may be used with the special variable *
.public final boolean isDistinct()
IAggregate
true
if the aggregate is to be applied to the distinct
solutions within the group. E.g.,
COUNT(DISTINCT x)
COUNT(DISTINCT *)or
SUM(DISTINCT x)
isDistinct
in interface IAggregate<E>
public boolean isWildcard()
IAggregate
true
iff the IValueExpression
is the special
variable *
(but note that this is only allowed for COUNT).isWildcard
in interface IAggregate<E>
public E get(IBindingSet bset)
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 get(IBindingSet)
.
get
in interface IAggregate<E>
get
in interface IValueExpression<E>
bset
- The binding set.Copyright © 2006–2019 SYSTAP, LLC DBA Blazegraph. All rights reserved.