Class AggregateFunDef.AggregateCalc
- java.lang.Object
-
- mondrian.calc.impl.AbstractCalc
-
- mondrian.calc.impl.GenericCalc
-
- mondrian.olap.fun.AggregateFunDef.AggregateCalc
-
- All Implemented Interfaces:
BooleanCalc,Calc,DateTimeCalc,DimensionCalc,DoubleCalc,HierarchyCalc,IntegerCalc,LevelCalc,MemberCalc,StringCalc,TupleCalc,VoidCalc
- Enclosing class:
- AggregateFunDef
public static class AggregateFunDef.AggregateCalc extends GenericCalc
-
-
Field Summary
-
Fields inherited from class mondrian.calc.impl.AbstractCalc
exp, type
-
-
Constructor Summary
Constructors Constructor Description AggregateCalc(Exp exp, ListCalc listCalc, Calc calc)AggregateCalc(Exp exp, ListCalc listCalc, Calc calc, Member member)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static Objectaggregate(Calc calc, Evaluator evaluator, TupleList tupleList)Computes an expression for each element of a list, and aggregates the result according to the evaluation context's current aggregation strategy.booleandependsOn(Hierarchy hierarchy)Returns whether this expression depends upon a given hierarchy.Objectevaluate(Evaluator evaluator)Evaluates this expression.static booleanisSuperSet(Member[] tuple1, Member[] tuple2)Returns whether tuple1 is a superset of tuple2.static Map<Member,Integer>[]membersVersusOccurencesInTuple(TupleList tupleList)Finds member occurrences in tuple and generates a map of Members versus their occurrences in tuples.static TupleListoptimizeChildren(TupleList tuples, SchemaReader reader, Cube baseCubeForMeasure)In distinct Count aggregation, if tuple list is a result m.children * n.children then it can be optimized to m * nstatic TupleListoptimizeTupleList(Evaluator evaluator, TupleList tupleList, boolean checkSize)static TupleListremoveOverlappingTupleEntries(TupleList list)In case of distinct count aggregation if a tuple which is a super set of other tuples in the set exists then the child tuples can be ignored.-
Methods inherited from class mondrian.calc.impl.GenericCalc
evaluateBoolean, evaluateDateTime, evaluateDimension, evaluateDouble, evaluateHierarchy, evaluateInteger, evaluateLevel, evaluateMember, evaluateString, evaluateTuple, evaluateVoid, numberToDouble
-
Methods inherited from class mondrian.calc.impl.AbstractCalc
accept, anyDepends, anyDependsButFirst, butDepends, collectArguments, getArguments, getCalcs, getName, getResultStyle, getType, isWrapperFor, simplifyEvaluator, unwrap
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface mondrian.calc.Calc
accept, getResultStyle, getType, isWrapperFor, unwrap
-
-
-
-
Method Detail
-
evaluate
public Object evaluate(Evaluator evaluator)
Description copied from interface:CalcEvaluates this expression.- Parameters:
evaluator- Provides dimensional context in which to evaluate this expression- Returns:
- Result of expression evaluation
-
aggregate
public static Object aggregate(Calc calc, Evaluator evaluator, TupleList tupleList)
Computes an expression for each element of a list, and aggregates the result according to the evaluation context's current aggregation strategy.- Parameters:
calc- Compiled expression to evaluate a scalarevaluator- Evaluation contexttupleList- List of members or tuples- Returns:
- Aggregated result
-
optimizeTupleList
public static TupleList optimizeTupleList(Evaluator evaluator, TupleList tupleList, boolean checkSize)
-
removeOverlappingTupleEntries
public static TupleList removeOverlappingTupleEntries(TupleList list)
In case of distinct count aggregation if a tuple which is a super set of other tuples in the set exists then the child tuples can be ignored.For example. A list consisting of: (Gender.[All Gender], [Product].[All Products]), (Gender.[F], [Product].[Drink]), (Gender.[M], [Product].[Food]) Can be optimized to: (Gender.[All Gender], [Product].[All Products])
- Parameters:
list- List of tuples
-
isSuperSet
public static boolean isSuperSet(Member[] tuple1, Member[] tuple2)
Returns whether tuple1 is a superset of tuple2.- Parameters:
tuple1- First tupletuple2- Second tuple- Returns:
- boolean Whether tuple1 is a superset of tuple2
-
dependsOn
public boolean dependsOn(Hierarchy hierarchy)
Description copied from interface:CalcReturns whether this expression depends upon a given hierarchy.If it does not depend on the hierarchy, then re-evaluating the expression with a different member of this context must produce the same answer.
Some examples:- The expression
depends on all dimensions except[Measures].[Unit Sales][Measures]. - The boolean expression
depends on all hierarchies except [Measures] and [Time].([Measures].[Unit Sales], [Time].[1997]) > 1000 - The list expression
depends upon all hierarchies except [Store] and [Measures]. How so? Normally the scalar expression would depend upon all hierarchies except [Measures], but theFilter([Store].[USA].Children, [Measures].[Unit Sales] < 50)Filterfunction sets the [Store] context before evaluating the scalar expression, so it is not inherited from the surrounding context.
- Specified by:
dependsOnin interfaceCalc- Overrides:
dependsOnin classAbstractCalc- Parameters:
hierarchy- Hierarchy- Returns:
- Whether this expression's result depends upon the current member of the hierarchy
- The expression
-
optimizeChildren
public static TupleList optimizeChildren(TupleList tuples, SchemaReader reader, Cube baseCubeForMeasure)
In distinct Count aggregation, if tuple list is a result m.children * n.children then it can be optimized to m * nE.g. List consist of: (Gender.[F], [Store].[USA]), (Gender.[F], [Store].[USA].[OR]), (Gender.[F], [Store].[USA].[CA]), (Gender.[F], [Store].[USA].[WA]), (Gender.[F], [Store].[CANADA]) (Gender.[M], [Store].[USA]), (Gender.[M], [Store].[USA].[OR]), (Gender.[M], [Store].[USA].[CA]), (Gender.[M], [Store].[USA].[WA]), (Gender.[M], [Store].[CANADA]) Can be optimized to: (Gender.[All Gender], [Store].[USA]) (Gender.[All Gender], [Store].[CANADA])
- Parameters:
tuples- Tuplesreader- Schema readerbaseCubeForMeasure- Cube- Returns:
- xxxx
-
membersVersusOccurencesInTuple
public static Map<Member,Integer>[] membersVersusOccurencesInTuple(TupleList tupleList)
Finds member occurrences in tuple and generates a map of Members versus their occurrences in tuples.- Parameters:
tupleList- List of tuples- Returns:
- Map of the number of occurrences of each member in a tuple
-
-