Class Segment
- Direct Known Subclasses:
SegmentWithData
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 Segment.ExcludedRegion
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}).
- Since:
- 21 March, 2002
- Author:
- jhyde
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic interface
Definition of a region of values which are not in a segment. -
Field Summary
Modifier and TypeFieldDescriptionprotected final RolapStar.Column[]
This is set in the load method and is used during the processing of a particular aggregate load.protected final List<StarPredicate>
protected final BitKey
protected final List<Segment.ExcludedRegion>
List of regions to ignore when reading this segment.final RolapStar.Measure
final StarColumnPredicate[]
An array of axes, one for each constraining column, containing the values returned for that constraining column.protected final RolapStar
-
Constructor Summary
ConstructorDescriptionSegment
(RolapStar star, BitKey constrainedColumnsBitKey, RolapStar.Column[] columns, RolapStar.Measure measure, StarColumnPredicate[] predicates, List<Segment.ExcludedRegion> excludedRegions, List<StarPredicate> compoundPredicateList) Creates aSegment
; it's not loaded yet. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
describeAxes
(StringBuilder buf, int i, boolean values) Returns the constrained columns.Returns the list of compound predicates.Returns the BitKey for ALL columns (Measures and Levels) involved in the query.getStar()
Returns the star.protected final boolean
isExcluded
(Object[] keys) Returns whether a cell value is excluded from this segment.boolean
matches
(AggregationKey aggregationKey, RolapStar.Measure measure) void
print
(PrintWriter pw) Prints the state of thisSegment
, including constraints and values.toString()
-
Field Details
-
columns
This is set in the load method and is used during the processing of a particular aggregate load. -
measure
-
predicates
An array of axes, one for each constraining column, containing the values returned for that constraining column. -
star
-
constrainedColumnsBitKey
-
excludedRegions
List of regions to ignore when reading this segment. This list is populated when a region is flushed. The cells for these regions may be physically in the segment, because trimming segments can be expensive, but should still be ignored. -
compoundPredicateList
-
-
Constructor Details
-
Segment
public Segment(RolapStar star, BitKey constrainedColumnsBitKey, RolapStar.Column[] columns, RolapStar.Measure measure, StarColumnPredicate[] predicates, List<Segment.ExcludedRegion> excludedRegions, List<StarPredicate> compoundPredicateList) Creates aSegment
; it's not loaded yet.- Parameters:
star
- Star that this Segment belongs tomeasure
- Measure whose values this Segment containspredicates
- List of predicates constraining each axisexcludedRegions
- List of regions which are not in this segment.
-
-
Method Details
-
getColumns
Returns the constrained columns. -
getStar
Returns the star. -
getCompoundPredicateList
Returns the list of compound predicates. -
getConstrainedColumnsBitKey
Returns the BitKey for ALL columns (Measures and Levels) involved in the query. -
describeAxes
-
toString
-
isExcluded
Returns whether a cell value is excluded from this segment. -
print
Prints the state of thisSegment
, including constraints and values. Blocks the current thread until the segment is loaded.- Parameters:
pw
- Writer
-
getExcludedRegions
-
matches
-
getHeader
-