|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object mondrian.rolap.RolapStar
public class RolapStar
A RolapStar
is a star schema. It is the means to read cell
values.
todo: put this in package which specicializes in relational aggregation, doesn't know anything about hierarchies etc.
Nested Class Summary | |
---|---|
static class |
RolapStar.AliasReplacer
Creates a copy of an expression, everywhere replacing one alias with another. |
static class |
RolapStar.Column
A column in a star schema. |
static class |
RolapStar.ColumnComparator
Comparator to compare columns based on their name |
static class |
RolapStar.Condition
|
static class |
RolapStar.Measure
Definition of a measure in a star schema. |
static class |
RolapStar.Table
Definition of a table in a star schema. |
Constructor Summary | |
---|---|
RolapStar(RolapSchema schema,
DataSource dataSource,
MondrianDef.Relation fact)
Creates a RolapStar. |
Method Summary | |
---|---|
void |
addAggStar(AggStar aggStar)
Adds an AggStar to this star. |
void |
checkAggregateModifications()
Checks whether an aggregation has changed since the last the time loaded. |
(package private) void |
clearAggStarList()
Set the agg star list to empty. |
(package private) void |
clearCachedAggregations(boolean forced)
Clears the aggregate cache. |
static void |
collectColumns(Collection<RolapStar.Column> columnList,
RolapStar.Table table,
MondrianDef.Column joinColumn)
Collects all columns in this table and its children. |
void |
flush(CacheControl cacheControl,
CacheControl.CellRegion region)
Flushes the contents of a given region of cells from this star. |
String |
generateSql(List<RolapStar.Column> columnList,
List<String> columnNameList)
Generates a SQL statement to read all instances of the given attributes. |
List<AggStar> |
getAggStars()
Returns this RolapStar's aggregate table AggStars, ordered in ascending order of size. |
List<String> |
getAliasList()
Returns a list of all aliases used in this star. |
BitKey |
getBitKey(String[] tableAlias,
String[] columnName)
|
DataSourceChangeListener |
getChangeListener()
Returns the listener for changes to this star's underlying database. |
int |
getColumnCount()
Returns this RolapStar's column count. |
DataSource |
getDataSource()
Returns the DataSource used to connect to the underlying DBMS. |
RolapStar.Table |
getFactTable()
Returns the fact table at the center of this RolapStar. |
RolapSchema |
getSchema()
|
SqlQuery |
getSqlQuery()
Clones an existing SqlQuery to create a new one (this cloning creates one with an empty sql query). |
SqlQuery.Dialect |
getSqlQueryDialect()
Returns this RolapStar's SQL dialect. |
static RolapStar.Measure |
getStarMeasure(Member member)
Retrieves the RolapStar.Measure in which a measure is stored. |
MondrianDef.RelationOrJoin |
getUniqueRelation(MondrianDef.RelationOrJoin rel,
String factForeignKey,
String primaryKey,
String primaryKeyTable)
Generates a unique relational join to the fact table via re-aliasing MondrianDef.Relations currently called in the RolapCubeHierarchy constructor. |
(package private) boolean |
isCacheAggregations()
Returns whether the this RolapStar cache aggregates. |
Aggregation |
lookupAggregation(AggregationKey aggregationKey)
Looks for an existing aggregation over a given set of columns, or returns null if there is none. |
RolapStar.Column |
lookupColumn(String tableAlias,
String columnName)
This is used by TestAggregationManager only. |
RolapStar.Column[] |
lookupColumns(String tableAlias,
String columnName)
Retrieves a named column, returns null if not found. |
Aggregation |
lookupOrCreateAggregation(AggregationKey aggregationKey)
Looks up an aggregation or creates one if it does not exist in an atomic (synchronized) operation. |
void |
prepareToLoadAggregates()
This is a place holder in case in the future we wish to be able to reload aggregates. |
void |
print(PrintWriter pw,
String prefix,
boolean structure)
Prints the state of this RolapStar |
void |
pushAggregateModificationsToGlobalCache()
Checks whether changed modifications may be pushed into global cache. |
void |
reOrderAggStarList()
Reorder the list of aggregate stars. |
(package private) void |
setCacheAggregations(boolean cacheAggregations)
Sets whether to cache database aggregation information; if false, cache is flushed after each query. |
void |
setChangeListener(DataSourceChangeListener changeListener)
Sets the listener for changes to this star's underlying database. |
void |
setDataSource(DataSource dataSource)
For testing purposes only. |
String |
toString()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
RolapStar(RolapSchema schema, DataSource dataSource, MondrianDef.Relation fact)
RolapSchema.RolapStarRegistry.getOrCreateStar(mondrian.olap.MondrianDef.Relation)
to create a
RolapStar
.
Method Detail |
---|
public MondrianDef.RelationOrJoin getUniqueRelation(MondrianDef.RelationOrJoin rel, String factForeignKey, String primaryKey, String primaryKeyTable)
rel
- the relation needing uniquenessfactForeignKey
- the foreign key of the fact tableprimaryKey
- the join key of the relationprimaryKeyTable
- the join table of the relation
public int getColumnCount()
public void prepareToLoadAggregates()
public void addAggStar(AggStar aggStar)
AggStar
to this star.
Internally the AggStars are added in sort order, smallest row count to biggest, so that the most efficient AggStar is encountered first; ties do not matter.
void clearAggStarList()
public void reOrderAggStarList()
public List<AggStar> getAggStars()
public RolapStar.Table getFactTable()
public SqlQuery getSqlQuery()
public SqlQuery.Dialect getSqlQueryDialect()
void setCacheAggregations(boolean cacheAggregations)
This method is called only by the RolapCube and is only called if caching is to be turned off. Note that the same RolapStar can be associated with more than on RolapCube. If any one of those cubes has caching turned off, then caching is turned off for all of them.
cacheAggregations
- Whether to cache database aggregationboolean isCacheAggregations()
setCacheAggregations(boolean)
void clearCachedAggregations(boolean forced)
setCacheAggregations(boolean)
).
forced
- If true, clears cached aggregations regardless of any other
settings. If false, clears only cache from the current threadpublic Aggregation lookupOrCreateAggregation(AggregationKey aggregationKey)
When a new aggregation is created, it is marked as thread local.
aggregationKey
- this is the contrained column bitkeypublic Aggregation lookupAggregation(AggregationKey aggregationKey)
null
if there is none.
Thread local cache is taken first.
Must be called from synchronized context.
public void checkAggregateModifications()
If so, a new thread local aggregation will be made and added after the query has finished.
This method should be called before a query is executed and afterwards
the function pushAggregateModificationsToGlobalCache()
should
be called.
public void pushAggregateModificationsToGlobalCache()
The method checks whether there are other running queries that are using the requested modifications. If this is the case, modifications are not pushed yet.
public void setDataSource(DataSource dataSource)
public DataSource getDataSource()
public static RolapStar.Measure getStarMeasure(Member member)
RolapStar.Measure
in which a measure is stored.
public RolapStar.Column[] lookupColumns(String tableAlias, String columnName)
public RolapStar.Column lookupColumn(String tableAlias, String columnName)
public BitKey getBitKey(String[] tableAlias, String[] columnName)
public List<String> getAliasList()
public static void collectColumns(Collection<RolapStar.Column> columnList, RolapStar.Table table, MondrianDef.Column joinColumn)
joinColumn
is specified, only considers child tables
joined by the given column.
public RolapSchema getSchema()
public String generateSql(List<RolapStar.Column> columnList, List<String> columnNameList)
The SQL statement is of the form SELECT ... FROM ... JOIN ...
GROUP BY ...
. It is useful for populating an aggregate table.
columnList
- List of columns (attributes and measures)columnNameList
- List of column names (must have same cardinality
as columnList
)
public String toString()
toString
in class Object
public void print(PrintWriter pw, String prefix, boolean structure)
RolapStar
pw
- Writerprefix
- Prefix to print at the start of each linestructure
- Whether to print the structure of the starpublic void flush(CacheControl cacheControl, CacheControl.CellRegion region)
cacheControl
- Cache control APIregion
- Predicate defining a region of cellspublic DataSourceChangeListener getChangeListener()
public void setChangeListener(DataSourceChangeListener changeListener)
changeListener
- The Data source change listener to set
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |