Package mondrian.rolap.agg
Class SegmentBuilder
- java.lang.Object
-
- mondrian.rolap.agg.SegmentBuilder
-
public class SegmentBuilder extends Object
Helper class that contains methods to convert betweenSegment
andSegmentHeader
, and alsoSegmentWithData
andSegmentBody
.- Author:
- LBoudreau
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static interface
SegmentBuilder.SegmentConverter
Functor to convert a segment header and body into aSegmentWithData
.static class
SegmentBuilder.SegmentConverterImpl
Implementation ofSegmentBuilder.SegmentConverter
that uses anAggregationKey
andCellRequest
as context to convert aSegmentHeader
.static class
SegmentBuilder.StarSegmentConverter
Implementation ofSegmentBuilder.SegmentConverter
that uses a star measure and a list ofStarPredicate
.
-
Constructor Summary
Constructors Constructor Description SegmentBuilder()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static SegmentWithData
addData(Segment segment, SegmentBody sb)
Converts a segment plus aSegmentBody
into aSegmentWithData
.static boolean
isSubset(SegmentHeader header, Segment segment)
Tells if the passed segment is a subset of this segment and could be used for a rollup in cache operation.static Pair<SegmentHeader,SegmentBody>
rollup(Map<SegmentHeader,SegmentBody> map, Set<String> keepColumns, BitKey targetBitkey, Aggregator rollupAggregator, Dialect.Datatype datatype)
Given a collection of segments, all of the same dimensionality, rolls up to create a segment with reduced dimensionality.static List<SegmentColumn>
toConstrainedColumns(Collection<StarColumnPredicate> predicates)
static List<SegmentColumn>
toConstrainedColumns(StarColumnPredicate[] predicates)
static SegmentHeader
toHeader(Segment segment)
Creates a SegmentHeader object describing the supplied Segment object.static Segment
toSegment(SegmentHeader header, RolapStar star, BitKey constrainedColumnsBitKey, RolapStar.Column[] constrainedColumns, RolapStar.Measure measure, List<StarPredicate> compoundPredicates)
Creates a segment from a SegmentHeader.
-
-
-
Method Detail
-
addData
public static SegmentWithData addData(Segment segment, SegmentBody sb)
Converts a segment plus aSegmentBody
into aSegmentWithData
.- Parameters:
segment
- Segmentsb
- Segment body- Returns:
- SegmentWithData
-
toSegment
public static Segment toSegment(SegmentHeader header, RolapStar star, BitKey constrainedColumnsBitKey, RolapStar.Column[] constrainedColumns, RolapStar.Measure measure, List<StarPredicate> compoundPredicates)
Creates a segment from a SegmentHeader. The star, constrainedColsBitKey, constrainedColumns and measure arguments are a helping hand, because we know what we were looking for.- Parameters:
header
- The header to convert.star
- StarconstrainedColumnsBitKey
- Constrained columnsconstrainedColumns
- Constrained columnsmeasure
- Measure- Returns:
- Segment
-
rollup
public static Pair<SegmentHeader,SegmentBody> rollup(Map<SegmentHeader,SegmentBody> map, Set<String> keepColumns, BitKey targetBitkey, Aggregator rollupAggregator, Dialect.Datatype datatype)
Given a collection of segments, all of the same dimensionality, rolls up to create a segment with reduced dimensionality.- Parameters:
map
- Source segment headers and bodieskeepColumns
- A list of column names to keep as part of the rolled up segment.targetBitkey
- The column bit key to match with the resulting segment.rollupAggregator
- The aggregator to use to rollup.datatype
- The data type to use.- Returns:
- Segment header and body of requested dimensionality
-
isSubset
public static boolean isSubset(SegmentHeader header, Segment segment)
Tells if the passed segment is a subset of this segment and could be used for a rollup in cache operation.- Parameters:
segment
- A segment which might be a subset of the current segment.- Returns:
- True or false.
-
toConstrainedColumns
public static List<SegmentColumn> toConstrainedColumns(StarColumnPredicate[] predicates)
-
toConstrainedColumns
public static List<SegmentColumn> toConstrainedColumns(Collection<StarColumnPredicate> predicates)
-
toHeader
public static SegmentHeader toHeader(Segment segment)
Creates a SegmentHeader object describing the supplied Segment object.- Parameters:
segment
- A segment object for which we want to generate a SegmentHeader.- Returns:
- A SegmentHeader describing the supplied Segment object.
-
-