Search in sources :

Example 1 with TupleList

use of mondrian.calc.TupleList in project mondrian by pentaho.

the class AggregationOnDistinctCountMeasuresTest method testShouldNotRemoveDuplicateTuples.

public void testShouldNotRemoveDuplicateTuples() {
    Member maleChildMember = member(Id.Segment.toList("Gender", "All Gender", "M"), salesCubeSchemaReader);
    Member femaleChildMember = member(Id.Segment.toList("Gender", "All Gender", "F"), salesCubeSchemaReader);
    List<Member> memberList = new ArrayList<Member>();
    memberList.add(maleChildMember);
    memberList.add(maleChildMember);
    memberList.add(femaleChildMember);
    TupleList tuples = new UnaryTupleList(memberList);
    tuples = optimizeChildren(tuples);
    assertEquals(3, tuples.size());
}
Also used : UnaryTupleList(mondrian.calc.impl.UnaryTupleList) TupleList(mondrian.calc.TupleList) ArrayTupleList(mondrian.calc.impl.ArrayTupleList) UnaryTupleList(mondrian.calc.impl.UnaryTupleList)

Example 2 with TupleList

use of mondrian.calc.TupleList in project mondrian by pentaho.

the class AggregationOnDistinctCountMeasuresTest method testMemberCountIsSameForAllMembersInTuple.

public void testMemberCountIsSameForAllMembersInTuple() {
    TupleList genderMembers = genderMembersIncludingAll(false, salesCubeSchemaReader, salesCube);
    TupleList storeMembers = storeMembersUsaAndCanada(false, salesCubeSchemaReader, salesCube);
    TupleList memberList = mutableCrossJoin(genderMembers, storeMembers);
    Map<Member, Integer>[] memberCounterMap = AggregateFunDef.AggregateCalc.membersVersusOccurencesInTuple(memberList);
    assertTrue(Util.areOccurencesEqual(memberCounterMap[0].values()));
    assertTrue(Util.areOccurencesEqual(memberCounterMap[1].values()));
}
Also used : UnaryTupleList(mondrian.calc.impl.UnaryTupleList) TupleList(mondrian.calc.TupleList) ArrayTupleList(mondrian.calc.impl.ArrayTupleList)

Example 3 with TupleList

use of mondrian.calc.TupleList in project mondrian by pentaho.

the class AggregationOnDistinctCountMeasuresTest method testMemberCountIsNotSameForAllMembersInTuple.

public void testMemberCountIsNotSameForAllMembersInTuple() {
    Member maleChild = member(Id.Segment.toList("Gender", "All Gender", "M"), salesCubeSchemaReader);
    Member femaleChild = member(Id.Segment.toList("Gender", "All Gender", "F"), salesCubeSchemaReader);
    Member mexicoMember = member(Id.Segment.toList("Store", "All Stores", "Mexico"), salesCubeSchemaReader);
    TupleList memberList = new UnaryTupleList(Collections.singletonList(maleChild));
    TupleList list2 = storeMembersUsaAndCanada(false, salesCubeSchemaReader, salesCube);
    memberList = mutableCrossJoin(memberList, list2);
    memberList.addTuple(femaleChild, mexicoMember);
    Map<Member, Integer>[] memberCounterMap = AggregateFunDef.AggregateCalc.membersVersusOccurencesInTuple(memberList);
    assertFalse(Util.areOccurencesEqual(memberCounterMap[0].values()));
    assertTrue(Util.areOccurencesEqual(memberCounterMap[1].values()));
}
Also used : UnaryTupleList(mondrian.calc.impl.UnaryTupleList) TupleList(mondrian.calc.TupleList) ArrayTupleList(mondrian.calc.impl.ArrayTupleList) UnaryTupleList(mondrian.calc.impl.UnaryTupleList)

Example 4 with TupleList

use of mondrian.calc.TupleList in project mondrian by pentaho.

the class AggregationOnDistinctCountMeasuresTest method testOptimizeChildrenWhenTuplesAreFormedWithDifferentLevels.

public void testOptimizeChildrenWhenTuplesAreFormedWithDifferentLevels() {
    TupleList genderMembers = genderMembersIncludingAll(false, salesCubeSchemaReader, salesCube);
    TupleList productMembers = productMembersPotScrubbersPotsAndPans(salesCubeSchemaReader);
    TupleList memberList = mutableCrossJoin(genderMembers, productMembers);
    TupleList tuples = optimizeChildren(memberList);
    assertEquals(4, tuples.size());
    assertFalse(tuppleListContains(tuples, member(Id.Segment.toList("Product", "All Products", "Non-Consumable", "Household", "Kitchen Products", "Pots and Pans", "Cormorant"), salesCubeSchemaReader)));
    assertTrue(tuppleListContains(tuples, member(Id.Segment.toList("Product", "All Products", "Non-Consumable", "Household", "Kitchen Products", "Pots and Pans"), salesCubeSchemaReader)));
    assertTrue(tuppleListContains(tuples, member(Id.Segment.toList("Product", "All Products", "Non-Consumable", "Household", "Kitchen Products", "Pot Scrubbers", "Cormorant"), salesCubeSchemaReader)));
}
Also used : UnaryTupleList(mondrian.calc.impl.UnaryTupleList) TupleList(mondrian.calc.TupleList) ArrayTupleList(mondrian.calc.impl.ArrayTupleList)

Example 5 with TupleList

use of mondrian.calc.TupleList in project mondrian by pentaho.

the class AggregationOnDistinctCountMeasuresTest method testWhetherCJOfChildren.

public void testWhetherCJOfChildren() {
    TupleList genderMembers = genderMembersIncludingAll(false, salesCubeSchemaReader, salesCube);
    TupleList storeMembers = storeMembersUsaAndCanada(false, salesCubeSchemaReader, salesCube);
    TupleList memberList = mutableCrossJoin(genderMembers, storeMembers);
    List tuples = optimizeChildren(memberList);
    assertEquals(2, tuples.size());
}
Also used : UnaryTupleList(mondrian.calc.impl.UnaryTupleList) TupleList(mondrian.calc.TupleList) ArrayTupleList(mondrian.calc.impl.ArrayTupleList) UnaryTupleList(mondrian.calc.impl.UnaryTupleList) TupleList(mondrian.calc.TupleList) ArrayTupleList(mondrian.calc.impl.ArrayTupleList)

Aggregations

TupleList (mondrian.calc.TupleList)29 UnaryTupleList (mondrian.calc.impl.UnaryTupleList)21 ArrayTupleList (mondrian.calc.impl.ArrayTupleList)12 Axis (mondrian.olap.Axis)4 ArrayList (java.util.ArrayList)3 ListTupleList (mondrian.calc.impl.ListTupleList)3 Member (mondrian.olap.Member)3 Execution (mondrian.server.Execution)3 SQLException (java.sql.SQLException)2 List (java.util.List)2 TupleIterable (mondrian.calc.TupleIterable)2 DelegatingTupleList (mondrian.calc.impl.DelegatingTupleList)2 ResolvedFunCall (mondrian.mdx.ResolvedFunCall)2 Exp (mondrian.olap.Exp)2 TestMember (mondrian.olap.fun.TestMember)2 TupleConstraint (mondrian.rolap.sql.TupleConstraint)2 TraversalList (mondrian.util.TraversalList)2 ResultSet (java.sql.ResultSet)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1