|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.rolap.agg.Segment
class Segment
A Segment
is a collection of cell values parameterized by
a measure, and a set of (column, value) pairs. An example of a segment is
(Unit sales, Gender = 'F', State in {'CA','OR'}, Marital Status = anything)
All segments over the same set of columns belong to an Aggregation, in this case
('Sales' Star, Gender, State, Marital Status)
Note that different measures (in the same Star) occupy the same Aggregation. Aggregations belong to the AggregationManager, a singleton.
Segments are pinned during the evaluation of a single MDX query. The query
evaluates the expressions twice. The first pass, it finds which cell values it
needs, pins the segments containing the ones which are already present (one
pin-count for each cell value used), and builds a cell request
for those which are not present. It executes
the cell request to bring the required cell values into the cache, again,
pinned. Then it evalutes the query a second time, knowing that all cell values
are available. Finally, it releases the pins.
A Segment may have a list of excluded Segment.Region
objects. These are
caused by cache flushing. Usually a segment is a hypercube: it is defined by
a set of values on each of its axes. But after a cache flush request, a
segment may have a rectangular 'hole', and therefore not be a hypercube
anymore.
For example, the segment defined by {CA, OR, WA} * {F, M} is a 2-dimensional hyper-rectangle with 6 cells. After flushing {CA, OR, TX} * {F}, the result is 4 cells:
F M CA out in OR out in WA in indefined by the original segment minus the region ({CA, OR} * {F}).
Nested Class Summary | |
---|---|
(package private) static class |
Segment.Region
Definition of a region of values which are not in a segment. |
Field Summary | |
---|---|
(package private) Aggregation |
aggregation
|
(package private) Aggregation.Axis[] |
axes
|
(package private) int |
id
|
(package private) RolapStar.Measure |
measure
|
Constructor Summary | |
---|---|
Segment(Aggregation aggregation,
RolapStar.Measure measure,
Aggregation.Axis[] axes,
List<Segment.Region> excludedRegions)
Creates a Segment ; it's not loaded yet. |
Method Summary | |
---|---|
(package private) Segment |
createSubSegment(BitSet[] axisKeepBitSets,
int bestColumn,
StarColumnPredicate bestPredicate,
List<Segment.Region> excludedRegions)
Creates a Segment which has the same dimensionality as this Segment and a subset of the values. |
int |
getCellCount()
Returns the number of cells in this Segment, deducting cells in excluded regions. |
(package private) Object |
getCellValue(Object[] keys)
Retrieves the value at the location identified by keys . |
(package private) SegmentDataset |
getData()
Returns this Segment's dataset, or null if the data has not yet been loaded. |
List<Segment.Region> |
getExcludedRegions()
|
(package private) boolean |
isFailed()
|
boolean |
isReady()
|
void |
print(PrintWriter pw)
Prints the state of this Segment , including constraints
and values. |
(package private) void |
setData(SegmentDataset data,
RolapAggregationManager.PinSet pinnedSegments)
Sets the data, and notifies any threads which are blocked in waitUntilLoaded() . |
(package private) void |
setFailIfStillLoading()
If this segment is still loading, signals that it failed to load, and notifies any threads which are blocked in waitUntilLoaded() . |
String |
toString()
|
void |
waitUntilLoaded()
Blocks until this segment has finished loading; if this segment has already loaded, returns immediately. |
(package private) boolean |
wouldContain(Object[] keys)
Returns whether the given set of key values will be in this segment when it finishes loading. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
final int id
final Aggregation aggregation
final RolapStar.Measure measure
final Aggregation.Axis[] axes
Constructor Detail |
---|
Segment(Aggregation aggregation, RolapStar.Measure measure, Aggregation.Axis[] axes, List<Segment.Region> excludedRegions)
Segment
; it's not loaded yet.
aggregation
- The aggregation this Segment
belongs tomeasure
- Measure whose values this Segment containsaxes
- List of axes; each is a constraint plus a list of valuesexcludedRegions
- List of regions which are not in this segment.Method Detail |
---|
void setData(SegmentDataset data, RolapAggregationManager.PinSet pinnedSegments)
waitUntilLoaded()
.
void setFailIfStillLoading()
waitUntilLoaded()
.
public boolean isReady()
boolean isFailed()
public String toString()
toString
in class Object
Object getCellValue(Object[] keys)
keys
.
Returns
Util.nullValue
if the cell value
is null (because no fact table rows met those criteria);null
if the value is not supposed to be in this segment
(because one or more of the keys do not pass the axis criteria);
boolean wouldContain(Object[] keys)
public void waitUntilLoaded()
public void print(PrintWriter pw)
Segment
, including constraints
and values. Blocks the current thread until the segment is loaded.
pw
- Writerpublic List<Segment.Region> getExcludedRegions()
public int getCellCount()
This method may return a value which is slightly too low, or occasionally even negative. This occurs when a Segment has more than one excluded region, and those regions overlap. Cells which are in both regions will be counted twice.
Segment createSubSegment(BitSet[] axisKeepBitSets, int bestColumn, StarColumnPredicate bestPredicate, List<Segment.Region> excludedRegions)
If bestColumn
is not -1, the bestColumn
th
column's predicate should be replaced by bestPredicate
.
axisKeepBitSets
- For each axis, a bitmap of the axis values to
keep; each axis must have at least one bit setbestColumn
- bestPredicate
- excludedRegions
- List of regions to exclude from segment
SegmentDataset getData()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |