Class Avg
- java.lang.Object
-
- org.teiid.query.function.aggregate.AggregateFunction
-
- org.teiid.query.function.aggregate.SingleArgumentAggregateFunction
-
- org.teiid.query.function.aggregate.Sum
-
- org.teiid.query.function.aggregate.Avg
-
public class Avg extends Sum
Accumulates (per tuple) and calculates the average of the values of a column. The type of the result varies depending on the type of the inputAggregateSymbol
- the type will not be an integral type but will always be some kind of decimal type.
-
-
Field Summary
-
Fields inherited from class org.teiid.query.function.aggregate.Sum
accumulatorType, BIG_DECIMAL, BIG_INTEGER, DOUBLE, LONG
-
Fields inherited from class org.teiid.query.function.aggregate.AggregateFunction
argIndexes
-
-
Constructor Summary
Constructors Constructor Description Avg()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInputDirect(Object input, List<?> tuple, CommandContext commandContext)
Object
getResult(CommandContext commandContext)
Called after all values have been processed to get the result.void
getState(List<Object> state)
List<? extends Class<?>>
getStateTypes()
void
initialize(Class<?> dataType, Class<?> inputType)
void
reset()
Called to reset the state of the function.int
setState(List<?> state, int index)
-
Methods inherited from class org.teiid.query.function.aggregate.Sum
getAccumulatorType
-
Methods inherited from class org.teiid.query.function.aggregate.SingleArgumentAggregateFunction
addInputDirect, initialize
-
Methods inherited from class org.teiid.query.function.aggregate.AggregateFunction
addInput, filter, getArgIndexes, getOutputType, respectsNull, setArgIndexes, setConditionIndex
-
-
-
-
Method Detail
-
initialize
public void initialize(Class<?> dataType, Class<?> inputType)
- Overrides:
initialize
in classSum
-
reset
public void reset()
Description copied from class:AggregateFunction
Called to reset the state of the function.
-
addInputDirect
public void addInputDirect(Object input, List<?> tuple, CommandContext commandContext) throws FunctionExecutionException, ExpressionEvaluationException, TeiidComponentException
- Overrides:
addInputDirect
in classSum
- Throws:
FunctionExecutionException
ExpressionEvaluationException
TeiidComponentException
-
getResult
public Object getResult(CommandContext commandContext) throws FunctionExecutionException, ExpressionEvaluationException, TeiidComponentException
Description copied from class:AggregateFunction
Called after all values have been processed to get the result.- Overrides:
getResult
in classSum
- Returns:
- Result value
- Throws:
FunctionExecutionException
ExpressionEvaluationException
TeiidComponentException
- See Also:
AggregateFunction.getResult(CommandContext)
-
getStateTypes
public List<? extends Class<?>> getStateTypes()
- Overrides:
getStateTypes
in classSum
-
-