public static class AggregateFunDef.AggregateCalc extends GenericCalc
exp, type
Constructor and Description |
---|
AggregateCalc(Exp exp,
ListCalc listCalc,
Calc calc) |
AggregateCalc(Exp exp,
ListCalc listCalc,
Calc calc,
Member member) |
Modifier and Type | Method and Description |
---|---|
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.
|
boolean |
dependsOn(Hierarchy hierarchy)
Returns whether this expression depends upon a given hierarchy.
|
Object |
evaluate(Evaluator evaluator)
Evaluates this expression.
|
static boolean |
isSuperSet(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 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 * n
|
static TupleList |
optimizeTupleList(Evaluator evaluator,
TupleList tupleList,
boolean checkSize) |
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.
|
evaluateBoolean, evaluateDateTime, evaluateDimension, evaluateDouble, evaluateHierarchy, evaluateInteger, evaluateLevel, evaluateMember, evaluateString, evaluateTuple, evaluateVoid, numberToDouble
accept, anyDepends, anyDependsButFirst, butDepends, collectArguments, getArguments, getCalcs, getName, getResultStyle, getType, isWrapperFor, simplifyEvaluator, unwrap
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
accept, getResultStyle, getType, isWrapperFor, unwrap
public Object evaluate(Evaluator evaluator)
Calc
evaluator
- Provides dimensional context in which to evaluate
this expressionpublic static Object aggregate(Calc calc, Evaluator evaluator, TupleList tupleList)
calc
- Compiled expression to evaluate a scalarevaluator
- Evaluation contexttupleList
- List of members or tuplespublic static TupleList optimizeTupleList(Evaluator evaluator, TupleList tupleList, boolean checkSize)
public static TupleList removeOverlappingTupleEntries(TupleList list)
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])
list
- List of tuplespublic static boolean isSuperSet(Member[] tuple1, Member[] tuple2)
tuple1
- First tupletuple2
- Second tuplepublic boolean dependsOn(Hierarchy hierarchy)
Calc
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:[Measures].[Unit Sales]
depends on all dimensions except [Measures]
.
([Measures].[Unit Sales],
[Time].[1997]) > 1000
depends on all hierarchies except [Measures] and [Time].
Filter([Store].[USA].Children,
[Measures].[Unit Sales] < 50)
depends upon all hierarchies except [Store] and [Measures].
How so? Normally the scalar expression would depend upon all hierarchies
except [Measures], but the Filter
function sets the [Store]
context before evaluating the scalar expression, so it is not inherited
from the surrounding context.
dependsOn
in interface Calc
dependsOn
in class AbstractCalc
hierarchy
- Hierarchypublic static TupleList optimizeChildren(TupleList tuples, SchemaReader reader, Cube baseCubeForMeasure)
E.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])
tuples
- Tuplesreader
- Schema readerbaseCubeForMeasure
- Cubepublic static Map<Member,Integer>[] membersVersusOccurencesInTuple(TupleList tupleList)
tupleList
- List of tuplesCopyright © 2018 Hitachi Vantara. All rights reserved.