Search in sources :

Example 11 with UnaryTupleList

use of mondrian.calc.impl.UnaryTupleList in project mondrian by pentaho.

the class CancellationTest method testMutableCrossJoinCancellation.

public void testMutableCrossJoinCancellation() throws MondrianException {
    // tests that cancellation/timeout is checked in
    // CrossJoinFunDef.mutableCrossJoin
    propSaver.set(propSaver.properties.CheckCancelOrTimeoutInterval, 1);
    RolapCube salesCube = (RolapCube) cubeByName(getTestContext().getConnection(), "Sales");
    SchemaReader salesCubeSchemaReader = salesCube.getSchemaReader(getTestContext().getConnection().getRole()).withLocus();
    TupleList productMembers = productMembersPotScrubbersPotsAndPans(salesCubeSchemaReader);
    String selectGenders = "select Gender.members on 0 from sales";
    Result genders = executeQuery(selectGenders);
    Evaluator gendersEval = ((RolapResult) genders).getEvaluator(new int[] { 0 });
    TupleList genderMembers = new UnaryTupleList();
    for (Position pos : genders.getAxes()[0].getPositions()) {
        genderMembers.add(pos);
    }
    Execution execution = spy(new Execution(genders.getQuery().getStatement(), 0));
    TupleList mutableCrossJoinResult = mutableCrossJoin(productMembers, genderMembers, execution);
    gendersEval.getQuery().getStatement().start(execution);
    // checkCancelOrTimeout should be called once
    // for each tuple from mutableCrossJoin since phase interval is 1
    // plus once for each productMembers item
    // since it gets through SqlStatement.execute
    int expectedCallsQuantity = mutableCrossJoinResult.size() + productMembers.size();
    verify(execution, times(expectedCallsQuantity)).checkCancelOrTimeout();
}
Also used : UnaryTupleList(mondrian.calc.impl.UnaryTupleList) TupleList(mondrian.calc.TupleList) UnaryTupleList(mondrian.calc.impl.UnaryTupleList) Execution(mondrian.server.Execution)

Aggregations

UnaryTupleList (mondrian.calc.impl.UnaryTupleList)11 TupleList (mondrian.calc.TupleList)6 AbstractListCalc (mondrian.calc.impl.AbstractListCalc)4 ArrayTupleList (mondrian.calc.impl.ArrayTupleList)4 ResolvedFunCall (mondrian.mdx.ResolvedFunCall)2 Exp (mondrian.olap.Exp)2 FunDef (mondrian.olap.FunDef)2 Member (mondrian.olap.Member)2 RolapHierarchy (mondrian.rolap.RolapHierarchy)2 Execution (mondrian.server.Execution)2 ArrayList (java.util.ArrayList)1 Calc (mondrian.calc.Calc)1 ListTupleList (mondrian.calc.impl.ListTupleList)1 MemberExpr (mondrian.mdx.MemberExpr)1 mondrian.olap (mondrian.olap)1 SetEvaluator (mondrian.olap.Evaluator.SetEvaluator)1 AggregateFunDef (mondrian.olap.fun.AggregateFunDef)1 CrossJoinTest (mondrian.olap.fun.CrossJoinTest)1 NullFunDef (mondrian.olap.fun.CrossJoinTest.NullFunDef)1 ParenthesesFunDef (mondrian.olap.fun.ParenthesesFunDef)1