Class 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
  • Field Details

  • Constructor Details

    • RolapAggregator

      protected RolapAggregator(String name, int ordinal, boolean distinct)
  • Method Details

    • 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 interface Aggregator
      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 interface Aggregator
      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 raw SegmentBody object.

      Only gets called if Aggregator.supportsFastAggregates(mondrian.spi.Dialect.Datatype) is true.

      This is only invoked for rollup operations.

      Specified by:
      aggregate in interface Aggregator
      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.