public class Segment extends Object
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}).
Modifier and Type | Class and Description |
---|---|
static interface |
Segment.ExcludedRegion
Definition of a region of values which are not in a segment.
|
Modifier and Type | Field and Description |
---|---|
protected RolapStar.Column[] |
columns
This is set in the load method and is used during
the processing of a particular aggregate load.
|
protected List<StarPredicate> |
compoundPredicateList |
protected BitKey |
constrainedColumnsBitKey |
protected List<Segment.ExcludedRegion> |
excludedRegions
List of regions to ignore when reading this segment.
|
RolapStar.Measure |
measure |
StarColumnPredicate[] |
predicates
An array of axes, one for each constraining column, containing the values
returned for that constraining column.
|
protected RolapStar |
star |
Constructor and Description |
---|
Segment(RolapStar star,
BitKey constrainedColumnsBitKey,
RolapStar.Column[] columns,
RolapStar.Measure measure,
StarColumnPredicate[] predicates,
List<Segment.ExcludedRegion> excludedRegions,
List<StarPredicate> compoundPredicateList)
Creates a
Segment ; it's not loaded yet. |
Modifier and Type | Method and Description |
---|---|
protected void |
describeAxes(StringBuilder buf,
int i,
boolean values) |
RolapStar.Column[] |
getColumns()
Returns the constrained columns.
|
List<StarPredicate> |
getCompoundPredicateList()
Returns the list of compound predicates.
|
BitKey |
getConstrainedColumnsBitKey()
Returns the BitKey for ALL columns (Measures and Levels) involved in the
query.
|
List<Segment.ExcludedRegion> |
getExcludedRegions() |
SegmentHeader |
getHeader() |
RolapStar |
getStar()
Returns the star.
|
protected 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 this
Segment , including constraints
and values. |
String |
toString() |
protected final RolapStar.Column[] columns
public final RolapStar.Measure measure
public final StarColumnPredicate[] predicates
protected final RolapStar star
protected final BitKey constrainedColumnsBitKey
protected final List<Segment.ExcludedRegion> excludedRegions
protected final List<StarPredicate> compoundPredicateList
public Segment(RolapStar star, BitKey constrainedColumnsBitKey, RolapStar.Column[] columns, RolapStar.Measure measure, StarColumnPredicate[] predicates, List<Segment.ExcludedRegion> excludedRegions, List<StarPredicate> compoundPredicateList)
Segment
; it's not loaded yet.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.public RolapStar.Column[] getColumns()
public RolapStar getStar()
public List<StarPredicate> getCompoundPredicateList()
public BitKey getConstrainedColumnsBitKey()
protected void describeAxes(StringBuilder buf, int i, boolean values)
protected final boolean isExcluded(Object[] keys)
public void print(PrintWriter pw)
Segment
, including constraints
and values. Blocks the current thread until the segment is loaded.pw
- Writerpublic List<Segment.ExcludedRegion> getExcludedRegions()
public boolean matches(AggregationKey aggregationKey, RolapStar.Measure measure)
public SegmentHeader getHeader()
Copyright © 2019 Hitachi Vantara. All rights reserved.