org.teiid.query.function.aggregate
Class AggregateFunction

java.lang.Object
  extended by org.teiid.query.function.aggregate.AggregateFunction
Direct Known Subclasses:
ArrayAgg, ConstantFunction, Count, Max, Min, SortingFilter, StatsFunction, Sum, TextAgg, XMLAgg

public abstract class AggregateFunction
extends java.lang.Object

This represents the interface for an aggregate function. The basic lifecycle is that the AggregateFunction is initialize()'d with the type of the element being aggregated, then addInput() is called for every row in the group, then getResult() is called to retrieve the result.


Constructor Summary
AggregateFunction()
           
 
Method Summary
 void addInput(java.util.List<?> tuple)
           
abstract  void addInputDirect(java.lang.Object input, java.util.List<?> tuple)
          Called for the element value in every row of a group.
abstract  java.lang.Object getResult()
          Called after all values have been processed to get the result.
 void initialize(java.lang.Class<?> dataType, java.lang.Class<?> inputType)
          Called to initialize the function.
abstract  void reset()
          Called to reset the state of the function.
 void setExpressionIndex(int expressionIndex)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateFunction

public AggregateFunction()
Method Detail

setExpressionIndex

public void setExpressionIndex(int expressionIndex)

initialize

public void initialize(java.lang.Class<?> dataType,
                       java.lang.Class<?> inputType)
Called to initialize the function. In the future this may expand with additional information.

Parameters:
dataType - Data type of element begin aggregated
inputType -

reset

public abstract void reset()
Called to reset the state of the function.


addInput

public void addInput(java.util.List<?> tuple)
              throws TeiidComponentException,
                     TeiidProcessingException
Throws:
TeiidComponentException
TeiidProcessingException

addInputDirect

public abstract void addInputDirect(java.lang.Object input,
                                    java.util.List<?> tuple)
                             throws TeiidComponentException,
                                    TeiidProcessingException
Called for the element value in every row of a group.

Parameters:
input - Input value, may be null
tuple -
Throws:
TeiidProcessingException
TeiidComponentException

getResult

public abstract java.lang.Object getResult()
                                    throws FunctionExecutionException,
                                           ExpressionEvaluationException,
                                           TeiidComponentException,
                                           TeiidProcessingException
Called after all values have been processed to get the result.

Returns:
Result value
Throws:
TeiidProcessingException
FunctionExecutionException
ExpressionEvaluationException
TeiidComponentException


Copyright © 2011. All Rights Reserved.