mondrian.rolap.agg
Class Aggregation

java.lang.Object
  extended by mondrian.rolap.agg.Aggregation

public class Aggregation
extends Object

A Aggregation is a pre-computed aggregation over a set of columns.

Rollup operations:

Representation of aggregations. Sparse and dense representations are necessary for different data sets. Should adapt automatically. Use an interface to hold the data set, so the segment doesn't care.

Suppose we have a segment {year=1997, quarter={1,2,3}, state={CA,WA}}. We want to roll up to a segment for {year=1997, state={CA,WA}}. We need to know that we have all quarters. We don't. Because year and quarter are independent, we know that we have all of the ...

Suppose we have a segment specified by {region=West, state=*, year=*}, which materializes to ({West}, {CA,WA,OR}, {1997,1998}). Because state=*, we can rollup to {region=West, year=*} or {region=West, year=1997}.

The space required for a segment depends upon the dimensionality (d), cell count (c) and the value count (v). We don't count the space required for the actual values, which is the same in any scheme.

Since:
28 August, 2001
Author:
jhyde
 

Nested Class Summary
(package private) static class Aggregation.Axis
           
 
Constructor Summary
Aggregation(AggregationKey aggregationKey)
          Creates an Aggregation.
 
Method Summary
 void flush(CacheControl cacheControl, RolapCacheRegion cacheRegion)
           
 Object getCellValue(RolapStar.Measure measure, Object[] keys, RolapAggregationManager.PinSet pinSet)
          Retrieves the value identified by keys.
 RolapStar.Column[] getColumns()
          This is called during Sql generation.
 BitKey getConstrainedColumnsBitKey()
          Returns the BitKey for ALL columns (Measures and Levels) involved in the query.
 Date getCreationTimestamp()
           
 RolapStar getStar()
          This is called during Sql generation.
 void load(RolapStar.Column[] columns, RolapStar.Measure[] measures, StarColumnPredicate[] predicates, RolapAggregationManager.PinSet pinnedSegments, GroupingSetsCollector groupingSetsCollector)
          Loads a set of segments into this aggregation, one per measure, each constrained by the same set of column values, and each pinned once.
 StarColumnPredicate[] optimizePredicates(RolapStar.Column[] columns, StarColumnPredicate[] predicates)
          Drops predicates, where the list of values is close to the values which would be returned anyway.
 void print(PrintWriter pw)
          Prints the state of this Aggregation to a writer.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Aggregation

public Aggregation(AggregationKey aggregationKey)
Creates an Aggregation.

Parameters:
aggregationKey - the key specifying the axes, the context and the RolapStar for this Aggregation
Method Detail

getCreationTimestamp

public Date getCreationTimestamp()
Returns:
Returns the timestamp when the aggregation was created

load

public void load(RolapStar.Column[] columns,
                 RolapStar.Measure[] measures,
                 StarColumnPredicate[] predicates,
                 RolapAggregationManager.PinSet pinnedSegments,
                 GroupingSetsCollector groupingSetsCollector)
Loads a set of segments into this aggregation, one per measure, each constrained by the same set of column values, and each pinned once.

A Column and its constraints are accessed at the same level in their respective arrays.

For example,

 measures = {unit_sales, store_sales},
 state = {CA, OR},
 gender = unconstrained


optimizePredicates

public StarColumnPredicate[] optimizePredicates(RolapStar.Column[] columns,
                                                StarColumnPredicate[] predicates)
Drops predicates, where the list of values is close to the values which would be returned anyway.


toString

public String toString()
Overrides:
toString in class Object

print

public void print(PrintWriter pw)
Prints the state of this Aggregation to a writer.

Parameters:
pw - Writer

flush

public void flush(CacheControl cacheControl,
                  RolapCacheRegion cacheRegion)

getCellValue

public Object getCellValue(RolapStar.Measure measure,
                           Object[] keys,
                           RolapAggregationManager.PinSet pinSet)
Retrieves the value identified by keys. If the requested cell is found in the loading segment, current Thread will be blocked until segment is loaded.

If pinSet is not null, pins the segment which holds it. pinSet ensures that a segment is only pinned once.

Returns null if no segment contains the cell.

Returns Util.nullValue if a segment contains the cell and the cell's value is null.


getColumns

public RolapStar.Column[] getColumns()
This is called during Sql generation.


getStar

public RolapStar getStar()
This is called during Sql generation.


getConstrainedColumnsBitKey

public BitKey getConstrainedColumnsBitKey()
Returns the BitKey for ALL columns (Measures and Levels) involved in the query.


SourceForge.net_Logo