Package mondrian.rolap
Class RolapAggregator
- java.lang.Object
-
- mondrian.olap.EnumeratedValues.BasicValue
-
- mondrian.rolap.RolapAggregator
-
- All Implemented Interfaces:
Aggregator
,EnumeratedValues.Value
- Direct Known Subclasses:
RolapAggregator.BaseAggor
public abstract class RolapAggregator extends EnumeratedValues.BasicValue implements Aggregator
Describes an aggregation operator, such as "sum" or "count".- Since:
- Jul 9, 2003
- Author:
- jhyde
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
RolapAggregator.AvgFromAvg
Aggregator used for aggregate tables implementing the average aggregator.static class
RolapAggregator.AvgFromSum
Aggregator used for aggregate tables implementing the average aggregator.static class
RolapAggregator.BaseAggor
This is the base class for implementing aggregators over sum and average columns in an aggregate table.static class
RolapAggregator.SumFromAvg
This is an aggregator used for aggregate tables implementing the sum aggregator.
-
Field Summary
Fields Modifier and Type Field Description static RolapAggregator
Avg
static RolapAggregator
Count
static RolapAggregator
DistinctCount
static EnumeratedValues<RolapAggregator>
enumeration
List of all valid aggregation operators.static RolapAggregator
Max
static RolapAggregator
Min
static RolapAggregator
Sum
-
Fields inherited from class mondrian.olap.EnumeratedValues.BasicValue
description, name, ordinal
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
RolapAggregator(String name, int ordinal, boolean distinct)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Object
aggregate(List<Object> rawData, Dialect.Datatype datatype)
Applies this aggregator over a raw list of objects for a rollup operation.String
getExpression(String operand)
Returns the expression to apply this aggregator to an operand.RolapAggregator
getNonDistinctAggregator()
If this is a distinct aggregator, returns the corresponding non-distinct aggregator, otherwise throws an error.Aggregator
getRollup()
Returns the aggregator used to roll up.boolean
isDistinct()
boolean
supportsFastAggregates(Dialect.Datatype dataType)
By default, fast rollup is not supported for all classes.-
Methods inherited from class mondrian.olap.EnumeratedValues.BasicValue
equals, getDescription, getName, getOrdinal, toString, unexpected
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface mondrian.olap.Aggregator
aggregate
-
-
-
-
Field Detail
-
Sum
public static final RolapAggregator Sum
-
Count
public static final RolapAggregator Count
-
Min
public static final RolapAggregator Min
-
Max
public static final RolapAggregator Max
-
Avg
public static final RolapAggregator Avg
-
DistinctCount
public static final RolapAggregator DistinctCount
-
enumeration
public static final EnumeratedValues<RolapAggregator> enumeration
List of all valid aggregation operators.
-
-
Constructor Detail
-
RolapAggregator
protected RolapAggregator(String name, int ordinal, boolean distinct)
-
-
Method Detail
-
isDistinct
public boolean isDistinct()
-
getExpression
public String getExpression(String operand)
Returns the expression to apply this aggregator to an operand. For example,getExpression("emp.sal")
returns"sum(emp.sal)"
.
-
getNonDistinctAggregator
public RolapAggregator getNonDistinctAggregator()
If this is a distinct aggregator, returns the corresponding non-distinct aggregator, otherwise throws an error.
-
getRollup
public Aggregator getRollup()
Returns the aggregator used to roll up. By default, aggregators roll up themselves.- Specified by:
getRollup
in interfaceAggregator
- Returns:
- aggregator used to combine sub-totals into a grand-total
-
supportsFastAggregates
public boolean supportsFastAggregates(Dialect.Datatype dataType)
By default, fast rollup is not supported for all classes.- Specified by:
supportsFastAggregates
in interfaceAggregator
- Parameters:
dataType
- The datatype of the object we would like to rollup.- Returns:
- Whether this aggregator supports fast aggregation
-
aggregate
public Object aggregate(List<Object> rawData, Dialect.Datatype datatype)
Description copied from interface:Aggregator
Applies this aggregator over a raw list of objects for a rollup operation. This is useful when the values are already resolved and we are dealing with a rawSegmentBody
object.Only gets called if
Aggregator.supportsFastAggregates(mondrian.spi.Dialect.Datatype)
is true.This is only invoked for rollup operations.
- Specified by:
aggregate
in interfaceAggregator
- Parameters:
rawData
- An array of values in its raw form, to be aggregated.- Returns:
- A rolled up value of the raw data. if the object type is not supported.
-
-