Search in sources :

Example 1 with ValueColumnPredicate

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;
}
Also used : ValueColumnPredicate(mondrian.rolap.agg.ValueColumnPredicate)

Example 2 with ValueColumnPredicate

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;
}
Also used : ArrayList(java.util.ArrayList) ValueColumnPredicate(mondrian.rolap.agg.ValueColumnPredicate) OrPredicate(mondrian.rolap.agg.OrPredicate) Member(mondrian.olap.Member)

Aggregations

ValueColumnPredicate (mondrian.rolap.agg.ValueColumnPredicate)2 ArrayList (java.util.ArrayList)1 Member (mondrian.olap.Member)1 OrPredicate (mondrian.rolap.agg.OrPredicate)1