use of mondrian.rolap.agg.ValueColumnPredicate in project mondrian by pentaho.
the class CompoundPredicateInfo method makePredicateForMember.
private StarPredicate makePredicateForMember(RolapCubeMember member, RolapCube baseCube, StarPredicate memberPredicate, Evaluator evaluator) {
while (member != null) {
RolapCubeLevel level = member.getLevel();
if (!level.isAll()) {
RolapStar.Column column = level.getBaseStarKeyColumn(baseCube);
StarPredicate addPredicate = null;
if (!member.isCalculated()) {
addPredicate = new ValueColumnPredicate(column, member.getKey());
} else {
addPredicate = makeCalculatedMemberPredicate(member, baseCube, evaluator);
}
if (memberPredicate == null) {
memberPredicate = addPredicate;
} else {
memberPredicate = memberPredicate.and(addPredicate);
}
}
// Don't need to constrain USA if CA is unique
if (member.getLevel().isUnique()) {
break;
}
member = member.getParentMember();
}
return memberPredicate;
}
use of mondrian.rolap.agg.ValueColumnPredicate in project mondrian by pentaho.
the class CompoundPredicateInfo method makeUnaryPredicate.
private StarPredicate makeUnaryPredicate(RolapCubeMember member, RolapCube baseCube, Evaluator evaluator) {
TupleConstraintStruct constraint = new TupleConstraintStruct();
SqlConstraintUtils.expandSupportedCalculatedMember(member, evaluator, constraint);
List<Member> expandedMemberList = constraint.getMembers();
for (Member checkMember : expandedMemberList) {
if (checkMember == null || checkMember.isCalculated() || !(checkMember instanceof RolapCubeMember)) {
throw MondrianResource.instance().UnsupportedCalculatedMember.ex(member.getName(), null);
}
}
List<StarPredicate> predicates = new ArrayList<StarPredicate>(expandedMemberList.size());
for (Member iMember : expandedMemberList) {
RolapCubeMember iCubeMember = ((RolapCubeMember) iMember);
RolapCubeLevel iLevel = iCubeMember.getLevel();
RolapStar.Column iColumn = iLevel.getBaseStarKeyColumn(baseCube);
Object iKey = iCubeMember.getKey();
StarPredicate iPredicate = new ValueColumnPredicate(iColumn, iKey);
predicates.add(iPredicate);
}
StarPredicate r = null;
if (predicates.size() == 1) {
r = predicates.get(0);
} else {
r = new OrPredicate(predicates);
}
return r;
}
Aggregations