|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectmondrian.rolap.SqlTupleReader
public class SqlTupleReader
Reads the members of a single level (level.members) or of multiple levels (crossjoin).
Allows the result to be restricted by a TupleConstraint. So
the SqlTupleReader can also read Member.Descendants (which is level.members
restricted to a common parent) and member.children (which is a special case
of member.descendants). Other constraints, especially for the current slicer
or evaluation context, are possible.
When a SqlTupleReader reads level.members, it groups the result into parent/children pairs and puts them into the cache. In order that these can be found later when the children of a parent are requested, a matching constraint must be provided for every parent.
TupleConstraint.addLevelConstraint(mondrian.rolap.sql.SqlQuery, RolapCube, mondrian.rolap.aggmatcher.AggStar, RolapLevel)
although it may do so to restrict
the result. Also it is permitted to cache the parent/children from all
members in MemberCache, so
TupleConstraint.getMemberChildrenConstraint(RolapMember)
should not return null.TupleConstraint.getMemberChildrenConstraint(RolapMember)
must return null. Also
TupleConstraint.addConstraint(mondrian.rolap.sql.SqlQuery, mondrian.rolap.RolapCube, mondrian.rolap.aggmatcher.AggStar)
is required to join the fact table for the levels table.
| Nested Class Summary | |
|---|---|
(package private) static class |
SqlTupleReader.WhichSelect
Description of the position of a SELECT statement in a UNION. |
| Nested classes/interfaces inherited from interface mondrian.rolap.TupleReader |
|---|
TupleReader.MemberBuilder |
| Field Summary | |
|---|---|
protected TupleConstraint |
constraint
|
(package private) int |
maxRows
|
(package private) List<TargetBase> |
targets
|
| Constructor Summary | |
|---|---|
SqlTupleReader(TupleConstraint constraint)
|
|
| Method Summary | |
|---|---|
void |
addLevelMembers(RolapLevel level,
TupleReader.MemberBuilder memberBuilder,
List<RolapMember> srcMembers)
Adds a hierarchy to retrieve members from. |
protected void |
addLevelMemberSql(SqlQuery sqlQuery,
RolapLevel level,
RolapCube baseCube,
SqlTupleReader.WhichSelect whichSelect,
AggStar aggStar)
Generates the SQL statement to access members of level. |
(package private) AggStar |
chooseAggStar(TupleConstraint constraint,
Evaluator evaluator)
Obtains the AggStar instance which corresponds to an aggregate table which can be used to support the member constraint. |
(package private) Pair<String,List<SqlStatement.Type>> |
generateSelectForLevels(DataSource dataSource,
RolapCube baseCube,
SqlTupleReader.WhichSelect whichSelect)
Generates the SQL string corresponding to the levels referenced. |
(package private) Collection<RolapCube> |
getBaseCubeCollection(Query query)
|
Object |
getCacheKey()
Returns an object that uniquely identifies the Result that this TupleReader would return. |
int |
getEnumTargetCount()
|
protected Evaluator |
getEvaluator(TupleConstraint constraint)
Obtains the evaluator used to find an aggregate table to support the Tuple constraint. |
(package private) int |
getMaxRows()
|
(package private) Pair<String,List<SqlStatement.Type>> |
makeLevelMembersSql(DataSource dataSource)
|
protected void |
prepareTuples(DataSource dataSource,
TupleList partialResult,
List<List<RolapMember>> newPartialResult)
|
TupleList |
readMembers(DataSource dataSource,
TupleList partialResult,
List<List<RolapMember>> newPartialResult)
Performs the read. |
TupleList |
readTuples(DataSource jdbcConnection,
TupleList partialResult,
List<List<RolapMember>> newPartialResult)
Performs the read. |
(package private) void |
setMaxRows(int maxRows)
|
(package private) Pair<String,List<SqlStatement.Type>> |
sqlForEmptyTuple(DataSource dataSource,
Collection<RolapCube> baseCubes)
|
(package private) boolean |
targetIsOnBaseCube(TargetBase target,
RolapCube baseCube)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final TupleConstraint constraint
List<TargetBase> targets
int maxRows
| Constructor Detail |
|---|
public SqlTupleReader(TupleConstraint constraint)
| Method Detail |
|---|
public void addLevelMembers(RolapLevel level,
TupleReader.MemberBuilder memberBuilder,
List<RolapMember> srcMembers)
TupleReader
addLevelMembers in interface TupleReaderlevel - level that the members correspond tomemberBuilder - used to build new members for this levelsrcMembers - if set, array of enumerated members that make up
this levelpublic Object getCacheKey()
TupleReaderTupleReader would return. Clients may use this as a key for
caching the result.
getCacheKey in interface TupleReaderpublic int getEnumTargetCount()
protected void prepareTuples(DataSource dataSource,
TupleList partialResult,
List<List<RolapMember>> newPartialResult)
public TupleList readMembers(DataSource dataSource,
TupleList partialResult,
List<List<RolapMember>> newPartialResult)
TupleReader
readMembers in interface TupleReaderdataSource - source for reading tuplespartialResult - partially cached result that should be used
instead of executing sql querynewPartialResult - if non-null, return the result of the read;
note that this is a subset of the full return list
public TupleList readTuples(DataSource jdbcConnection,
TupleList partialResult,
List<List<RolapMember>> newPartialResult)
TupleReader
readTuples in interface TupleReaderjdbcConnection - Data sourcepartialResult - List of rows from previous passnewPartialResult - Populated with a new list of rows
Pair<String,List<SqlStatement.Type>> makeLevelMembersSql(DataSource dataSource)
Collection<RolapCube> getBaseCubeCollection(Query query)
Pair<String,List<SqlStatement.Type>> sqlForEmptyTuple(DataSource dataSource,
Collection<RolapCube> baseCubes)
Pair<String,List<SqlStatement.Type>> generateSelectForLevels(DataSource dataSource,
RolapCube baseCube,
SqlTupleReader.WhichSelect whichSelect)
dataSource - jdbc connection that they query will execute againstbaseCube - this is the cube object for regular cubes, and the
underlying base cube for virtual cubeswhichSelect - Position of this select statement in a union
boolean targetIsOnBaseCube(TargetBase target,
RolapCube baseCube)
protected void addLevelMemberSql(SqlQuery sqlQuery,
RolapLevel level,
RolapCube baseCube,
SqlTupleReader.WhichSelect whichSelect,
AggStar aggStar)
level. For
example, accesses the "City" level of the "Customers" hierarchy. Note that:SELECT "country", "state_province", "city" FROM "customer" GROUP BY "country", "state_province", "city", "init", "bar" ORDER BY "country", "state_province", "city"
"country", "state_province" are the parent keys;"city" is the level key;"init", "bar" are member properties.
sqlQuery - the query object being constructedlevel - level to be added to the sql querybaseCube - this is the cube object for regular cubes, and the
underlying base cube for virtual cubeswhichSelect - describes whether this select belongs to a largeraggStar - aggregate star if availableprotected Evaluator getEvaluator(TupleConstraint constraint)
constraint - Constraint
AggStar chooseAggStar(TupleConstraint constraint,
Evaluator evaluator)
constraint - evaluator - the current evaluator to obtain the cube and members to
be queried @return AggStar for aggregate tableint getMaxRows()
void setMaxRows(int maxRows)
|
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||