Package mondrian.rolap
Class RolapStar.Table
- java.lang.Object
-
- mondrian.rolap.RolapStar.Table
-
- Enclosing class:
- RolapStar
public static class RolapStar.Table extends Object
Definition of a table in a star schema.A 'table' is defined by a
MondrianDef.RelationOrJoinso may, in fact, be a view.Every table in the star schema except the fact table has a parent table, and a condition which specifies how it is joined to its parent. So the star schema is, in effect, a hierarchy with the fact table at its root.
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddToFrom(SqlQuery query, boolean failIfExists, boolean joinToParent)Adds this table to the FROM clause of a query, and also, ifjoinToParent, any join condition.booleancontainsColumn(String columnName)Returns whether this table has a column with the given name.booleancontainsColumn(RolapStar.Column column)booleanequals(Object obj)booleanequalsTableName(String tableName)RolapStar.TablefindAncestor(String tableName)Returns an ancestor with a given alias, or null if not found.RolapStar.TablefindChild(MondrianDef.Relation relation, RolapStar.Condition joinCondition)Returns a child relation which maps onto a given relation, or null if there is none.RolapStar.TablefindDescendant(String seekAlias)Returns a descendant with a given alias, or null if none found.RolapStar.TablefindTableWithLeftCondition(MondrianDef.Expression left)This is used during aggregate table validation to make sure that the mapping from for the aggregate join condition is valid.RolapStar.TablefindTableWithLeftJoinCondition(String columnName)Finds the child table of the fact table with the given columnName used in its left join condition.StringgetAlias()List<RolapStar.Table>getChildren()Returns a list of childRolapStar.Tables.List<RolapStar.Column>getColumns()Returns a list of this table'sRolapStar.Columns.RolapStar.ConditiongetJoinCondition()Returns the condition by which a dimension table is connected to itsparent; or null if this is the fact table.RolapStar.TablegetParentTable()Returns this table's parent table, or null if this is the fact table (which is at the center of the star).MondrianDef.RelationgetRelation()StringgetTableName()Sometimes one need to get to the "real" name when the table has been given an alias.inthashCode()booleanisFunky()Note: I do not think that this is ever true.RolapStar.ColumnlookupColumn(String columnName)RolapStar.ColumnlookupColumnByExpression(MondrianDef.Expression xmlExpr)Given a MondrianDef.Expression return a column with that expression or null.RolapStar.Column[]lookupColumns(String columnName)Returns an array of all columns in this star with a given name.RolapStar.MeasurelookupMeasureByName(String cubeName, String name)Look up aRolapStar.Measureby its name.voidprint(PrintWriter pw, String prefix)Prints this table and its children.StringtoString()
-
-
-
Method Detail
-
getJoinCondition
public RolapStar.Condition getJoinCondition()
Returns the condition by which a dimension table is connected to itsparent; or null if this is the fact table.
-
getParentTable
public RolapStar.Table getParentTable()
Returns this table's parent table, or null if this is the fact table (which is at the center of the star).
-
lookupColumns
public RolapStar.Column[] lookupColumns(String columnName)
Returns an array of all columns in this star with a given name.
-
lookupColumn
public RolapStar.Column lookupColumn(String columnName)
-
lookupColumnByExpression
public RolapStar.Column lookupColumnByExpression(MondrianDef.Expression xmlExpr)
Given a MondrianDef.Expression return a column with that expression or null.
-
containsColumn
public boolean containsColumn(RolapStar.Column column)
-
lookupMeasureByName
public RolapStar.Measure lookupMeasureByName(String cubeName, String name)
Look up aRolapStar.Measureby its name. Returns null if not found.
-
getRelation
public MondrianDef.Relation getRelation()
-
getAlias
public String getAlias()
-
getTableName
public String getTableName()
Sometimes one need to get to the "real" name when the table has been given an alias.
-
findChild
public RolapStar.Table findChild(MondrianDef.Relation relation, RolapStar.Condition joinCondition)
Returns a child relation which maps onto a given relation, or null if there is none.
-
findDescendant
public RolapStar.Table findDescendant(String seekAlias)
Returns a descendant with a given alias, or null if none found.
-
findAncestor
public RolapStar.Table findAncestor(String tableName)
Returns an ancestor with a given alias, or null if not found.
-
equalsTableName
public boolean equalsTableName(String tableName)
-
addToFrom
public void addToFrom(SqlQuery query, boolean failIfExists, boolean joinToParent)
Adds this table to the FROM clause of a query, and also, ifjoinToParent, any join condition.- Parameters:
query- Query to add tofailIfExists- Pass in false if you might have already added the table before and if that happens you want to do nothing.joinToParent- Pass in true if you are constraining a cell calculation, false if you are retrieving members.
-
getChildren
public List<RolapStar.Table> getChildren()
Returns a list of childRolapStar.Tables.
-
getColumns
public List<RolapStar.Column> getColumns()
Returns a list of this table'sRolapStar.Columns.
-
findTableWithLeftJoinCondition
public RolapStar.Table findTableWithLeftJoinCondition(String columnName)
Finds the child table of the fact table with the given columnName used in its left join condition. This is used by the AggTableManager while characterizing the fact table columns.
-
findTableWithLeftCondition
public RolapStar.Table findTableWithLeftCondition(MondrianDef.Expression left)
This is used during aggregate table validation to make sure that the mapping from for the aggregate join condition is valid. It returns the child table with the matching left join condition.
-
isFunky
public boolean isFunky()
Note: I do not think that this is ever true.
-
print
public void print(PrintWriter pw, String prefix)
Prints this table and its children.
-
containsColumn
public boolean containsColumn(String columnName)
Returns whether this table has a column with the given name.
-
-