com.bigdata.bop.aggregate.IAggregate Maven / Gradle / Ivy
package com.bigdata.bop.aggregate;
import com.bigdata.bop.IBindingSet;
import com.bigdata.bop.IValueExpression;
/**
* An aggregate operator, such as SUM, COUNT, MIN, MAX, etc.
*
* @author thompsonbry
*/
public interface IAggregate extends IValueExpression{
/**
* 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)
*
*/
boolean isDistinct();
/**
* Return true
iff the {@link IValueExpression} is the special
* variable *
(but note that this is only allowed for COUNT).
*/
boolean isWildcard();
/**
* Reset the aggregate's internal state.
*/
void reset();
/**
* Return the current value of the aggregate (this has a side-effect on the
* internal state of the {@link IAggregate} operator). Functions which can
* not produce an intermediate result, such as AVERAGE, MAY return
* null
.
*
* Note: If evaluation of the {@link IAggregate} throws an error, then that
* error must be "sticky" and reported out by {@link #done()} as well. This
* contract is relied on to correctly propagate errors within a group when
* using incremental (pipelined) evaluation of {@link IAggregate}s. The
* error state is cleared by {@link #reset()}.
*/
E get(IBindingSet bset);
/**
* Return the final value.
*
* @throws RuntimeException
* If evaluation of {@link IAggregate#get(IBindingSet)} threw an
* error, then that error is "sticky" and the first such error
* encountered will be thrown out of {@link #done()} as well.
*/
E done();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy