com.bigdata.bop.aggregate
Interface IAggregate<E>

All Superinterfaces:
BOp, Cloneable, IPropertySet, IValueExpression<E>, Serializable
All Known Implementing Classes:
AggregateBase, AVERAGE, COUNT, GROUP_CONCAT, MAX, MIN, SAMPLE, SUM

public interface IAggregate<E>
extends IValueExpression<E>

An aggregate operator, such as SUM, COUNT, MIN, MAX, etc.

Author:
thompsonbry

Nested Class Summary
 
Nested classes/interfaces inherited from interface com.bigdata.bop.BOp
BOp.Annotations
 
Field Summary
 
Fields inherited from interface com.bigdata.bop.BOp
NOANNS, NOARGS
 
Method Summary
 E done()
          Return the final value.
 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).
 void reset()
          Reset the aggregate's internal state.
 
Methods inherited from interface com.bigdata.bop.BOp
annotations, argIterator, args, arity, clone, get, getEvaluationContext, getId, getProperty, getRequiredProperty, isController, setProperty, toArray, toArray, toShortString, toString
 
Methods inherited from interface cutthecrap.utils.striterators.IPropertySet
getProperty
 

Method Detail

isDistinct

boolean isDistinct()
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)
 


isWildcard

boolean isWildcard()
Return true iff the IValueExpression is the special variable * (but note that this is only allowed for COUNT).


reset

void reset()
Reset the aggregate's internal state.


get

E get(IBindingSet bset)
Return the current value of the aggregate (this has a side-effect on the internal state of the 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 done() as well. This contract is relied on to correctly propagate errors within a group when using incremental (pipelined) evaluation of IAggregates. The error state is cleared by reset().

Specified by:
get in interface IValueExpression<E>
Parameters:
bset - The binding set.
Returns:
The as bound value of the constant, variable, or expression.

done

E done()
Return the final value.

Throws:
RuntimeException - If evaluation of get(IBindingSet) threw an error, then that error is "sticky" and the first such error encountered will be thrown out of done() as well.


Copyright © 2006-2012 SYSTAP, LLC. All Rights Reserved.