Package mondrian.spi

Class SegmentHeader

  • All Implemented Interfaces:
    Serializable

    public class SegmentHeader
    extends Object
    implements Serializable
    SegmentHeaders are the key objects used to retrieve the segments from the segment cache.

    The segment header objects are immutable and fully serializable.

    The headers have each an ID which is a SHA-256 checksum of the following properties, concatenated. See getUniqueID()

    • Schema Name
    • Cube Name
    • Measure Name
    • For each column:
      • Column table name
      • Column physical name
      • For each predicate value:
        • The equivalent of String.valueof([value object])
    Author:
    LBoudreau
    See Also:
    Serialized Form
    • Field Detail

      • compoundPredicates

        public final List<String> compoundPredicates
      • measureName

        public final String measureName
      • cubeName

        public final String cubeName
      • schemaName

        public final String schemaName
      • rolapStarFactTableName

        public final String rolapStarFactTableName
      • constrainedColsBitKey

        public final BitKey constrainedColsBitKey
      • schemaChecksum

        public final ByteString schemaChecksum
    • Constructor Detail

      • SegmentHeader

        public SegmentHeader​(String schemaName,
                             ByteString schemaChecksum,
                             String cubeName,
                             String measureName,
                             List<SegmentColumn> constrainedColumns,
                             List<String> compoundPredicates,
                             String rolapStarFactTableName,
                             BitKey constrainedColsBitKey,
                             List<SegmentColumn> excludedRegions)
        Creates a segment header.
        Parameters:
        schemaName - The name of the schema which this header belongs to.
        schemaChecksum - Schema checksum
        cubeName - The name of the cube this segment belongs to.
        measureName - The name of the measure which defines this header.
        constrainedColumns - An array of constrained columns objects which define the predicated of this segment header.
        compoundPredicates - Compound predicates (Must not be null, but typically empty.)
        rolapStarFactTableName - Star fact table name
        constrainedColsBitKey - Constrained columns bit key
        excludedRegions - Excluded regions. (Must not be null, but typically
    • Method Detail

      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class Object
      • clone

        public SegmentHeader clone​(SegmentColumn[] overrideValues)
        Creates a clone of this header by replacing some of the constrained columns in the process.
        Parameters:
        overrideValues - A list of constrained columns to either replace or add to the original header.
        Returns:
        A clone of the header with the columns replaced.
      • canConstrain

        public boolean canConstrain​(SegmentColumn[] region)
        Checks if this header can be constrained by a given region.

        It will return false if the region covers one of the axis in its entirety.

        It will return false if the region sits outside of the bounds of this header. This means that when performing a flush operation, the header must be scrapped altogether.

      • constrain

        public SegmentHeader constrain​(SegmentColumn[] region)
        Applies a set of exclusions to this segment header and returns a new segment header representing the original one to which a region has been excluded.
        Parameters:
        region - Region
        Returns:
        Header with constraint applied
      • getArity

        public int getArity()
        Returns the arity of this SegmentHeader.
        Returns:
        The arity as an integer number.
      • getConstrainedColumns

        public List<SegmentColumn> getConstrainedColumns()
        Returns a list of constrained columns which define this segment header. The caller should consider this list immutable.
        Returns:
        List of ConstrainedColumns
      • getConstrainedColumn

        public SegmentColumn getConstrainedColumn​(String columnExpression)
        Returns the constrained column object, if any, corresponding to a column name and a table name.
        Parameters:
        columnExpression - The column name we want.
        Returns:
        A Constrained column, or null.
      • getConstrainedColumnsBitKey

        public BitKey getConstrainedColumnsBitKey()
      • getUniqueID

        public ByteString getUniqueID()
        Returns a unique identifier for this header. The identifier can be used for storage and will be the same across segments which have the same schema name, cube name, measure name, and for each constrained column, the same column name, table name, and predicate values.
        Returns:
        A unique identification string.
      • getDescription

        public String getDescription()
        Returns a human readable description of this segment header.
        Returns:
        A string describing the header.