public class SqlContextConstraint extends Object implements MemberChildrenConstraint, TupleConstraint
For example, if you have two dimensions, "invoice" and "time", and the current context (e.g. the slicer) contains a day from the "time" dimension, then only the invoices of that day are found. Used to optimize NON EMPTY.
The TupleConstraint
methods may silently ignore calculated
members (depends on the strict
c'tor argument), so these may
return more members than the current context restricts to. The
MemberChildren methods will never accept calculated members as parents,
these will cause an exception.
Modifier and Type | Method and Description |
---|---|
void |
addConstraint(SqlQuery sqlQuery,
RolapCube baseCube,
AggStar aggStar)
Called from LevelMembers: restricts the SQL resultset to the current
context.
|
void |
addLevelConstraint(SqlQuery sqlQuery,
RolapCube baseCube,
AggStar aggStar,
RolapLevel level)
Will be called once for the level that contains the
children of a Member.Children query.
|
void |
addMemberConstraint(SqlQuery sqlQuery,
RolapCube baseCube,
AggStar aggStar,
List<RolapMember> parents)
Adds
parents to the current
context and restricts the SQL resultset to that new context. |
void |
addMemberConstraint(SqlQuery sqlQuery,
RolapCube baseCube,
AggStar aggStar,
RolapMember parent)
Called from MemberChildren: adds
parent to the current
context and restricts the SQL resultset to that new context. |
Object |
getCacheKey()
Returns a key that becomes part of the key for caching the
result of the SQL query.
|
Evaluator |
getEvaluator() |
MemberChildrenConstraint |
getMemberChildrenConstraint(RolapMember parent)
When the members of a level are fetched, the result is grouped
by into parents and their children.
|
protected boolean |
isJoinRequired()
Returns whether a join with the fact table is required.
|
static boolean |
isValidContext(Evaluator context,
boolean strict) |
static boolean |
isValidContext(Evaluator context,
boolean disallowVirtualCube,
Level[] levels,
boolean strict) |
boolean |
supportsAggTables() |
public static boolean isValidContext(Evaluator context, boolean strict)
context
- evaluation contextstrict
- false if more rows than requested may be returned
(i.e. the constraint is incomplete)public static boolean isValidContext(Evaluator context, boolean disallowVirtualCube, Level[] levels, boolean strict)
context
- evaluation contextdisallowVirtualCube
- if true, check for virtual cubeslevels
- levels being referenced in the current contextstrict
- false if more rows than requested may be returned
(i.e. the constraint is incomplete)public void addMemberConstraint(SqlQuery sqlQuery, RolapCube baseCube, AggStar aggStar, RolapMember parent)
parent
to the current
context and restricts the SQL resultset to that new context.addMemberConstraint
in interface MemberChildrenConstraint
sqlQuery
- the query to modifybaseCube
- base cube for virtual membersaggStar
- Aggregate star, if we are reading from an aggregate table,parent
- the parent member that restricts the returned childrenpublic void addMemberConstraint(SqlQuery sqlQuery, RolapCube baseCube, AggStar aggStar, List<RolapMember> parents)
parents
to the current
context and restricts the SQL resultset to that new context.addMemberConstraint
in interface MemberChildrenConstraint
sqlQuery
- Query to modifybaseCube
- Base cube for virtual membersaggStar
- Aggregate table, or null if query is against fact tableparents
- List of parent members that restrict the returned
childrenpublic void addConstraint(SqlQuery sqlQuery, RolapCube baseCube, AggStar aggStar)
addConstraint
in interface TupleConstraint
sqlQuery
- the query to modifybaseCube
- base cube for virtual cube constraintsaggStar
- aggregate star to useprotected boolean isJoinRequired()
public void addLevelConstraint(SqlQuery sqlQuery, RolapCube baseCube, AggStar aggStar, RolapLevel level)
MemberChildrenConstraint
addLevelConstraint
in interface MemberChildrenConstraint
addLevelConstraint
in interface TupleConstraint
sqlQuery
- the query to modifybaseCube
- base cube for virtual membersaggStar
- Aggregate table, or null if query is against fact tablelevel
- the level that contains the childrenpublic MemberChildrenConstraint getMemberChildrenConstraint(RolapMember parent)
TupleConstraint
The returned MemberChildrenConstraint must be one that would have returned the same children for the given parent as the MemberLevel query has found for that parent.
If null is returned, the parent/children will not be cached (but the level/members still will be).
getMemberChildrenConstraint
in interface TupleConstraint
public Object getCacheKey()
SqlConstraint
getCacheKey
in interface SqlConstraint
public Evaluator getEvaluator()
getEvaluator
in interface TupleConstraint
public boolean supportsAggTables()
supportsAggTables
in interface TupleConstraint
Copyright © 2018 Hitachi Vantara. All rights reserved.