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());
}
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()));
}
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()));
}
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)));
}
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());
}
Aggregations