Package mondrian.spi
Class SegmentColumn
- java.lang.Object
-
- mondrian.spi.SegmentColumn
-
- All Implemented Interfaces:
java.io.Serializable
public class SegmentColumn extends java.lang.Object implements java.io.Serializable
Constrained columns are part of the SegmentHeader and SegmentCache. They uniquely identify a constrained column within a segment. Each segment can have many constrained columns. Each column can be constrained by multiple values at once (similar to a SQL in() predicate).They are immutable and serializable.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description java.lang.String
columnExpression
int
valueCount
java.util.SortedSet<java.lang.Comparable>
values
-
Constructor Summary
Constructors Constructor Description SegmentColumn(java.lang.String columnExpression, int valueCount, java.util.SortedSet<java.lang.Comparable> valueList)
Creates a SegmentColumn.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
equals(java.lang.Object obj)
java.lang.String
getColumnExpression()
Returns the column expression of this constrained column.int
getValueCount()
Returns the number of distinct values that occur for this column in the database.java.util.SortedSet<java.lang.Comparable>
getValues()
Returns an array of predicate values for this column.int
hashCode()
SegmentColumn
merge(SegmentColumn col)
Merges this column with another resulting in another whose values are super set of both.
-
-
-
Constructor Detail
-
SegmentColumn
public SegmentColumn(java.lang.String columnExpression, int valueCount, java.util.SortedSet<java.lang.Comparable> valueList)
Creates a SegmentColumn.- Parameters:
columnExpression
- SQL expression for the column. Unique within the star schema, including accesses to the same physical column via different join paths.valueCount
- Number of distinct values of this column in the database. For these purposes, null is counted as a value. If there are N distinct values of the column, and we have a collection of segments that cover N values, then Mondrian assumes that it is safe to roll up.valueList
- List of values to constrain the column to, or null if unconstrained. Values must beComparable
and immutable. For example, Integer, Boolean, String or Double.
-
-
Method Detail
-
merge
public SegmentColumn merge(SegmentColumn col)
Merges this column with another resulting in another whose values are super set of both.
-
getColumnExpression
public java.lang.String getColumnExpression()
Returns the column expression of this constrained column.- Returns:
- A column expression.
-
getValues
public java.util.SortedSet<java.lang.Comparable> getValues()
Returns an array of predicate values for this column.- Returns:
- An array of object values.
-
equals
public boolean equals(java.lang.Object obj)
- Overrides:
equals
in classjava.lang.Object
-
hashCode
public int hashCode()
- Overrides:
hashCode
in classjava.lang.Object
-
getValueCount
public int getValueCount()
Returns the number of distinct values that occur for this column in the database.Mondrian uses this to know that it can safely combine multiple segments to roll up. For example, if for the "quarter" column, one segment has values {"Q1", "Q2"} and another has values {"Q3", "Q4"}, and Mondrian knows that there are 4 values, then it can roll up.
If this method returns a value that is too low, Mondrian may generate incorrect results. If you don't know the number of values, return -1.
- Returns:
- Number of distinct values, including null, that occur for this column
-
-