Class AggregateFunDef.AggregateCalc

    • Constructor Detail

      • AggregateCalc

        public AggregateCalc​(Exp exp,
                             ListCalc listCalc,
                             Calc calc)
    • Method Detail

      • evaluate

        public Object evaluate​(Evaluator evaluator)
        Description copied from interface: Calc
        Evaluates 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 scalar
        evaluator - Evaluation context
        tupleList - List of members or tuples
        Returns:
        Aggregated result
      • 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 tuple
        tuple2 - Second tuple
        Returns:
        boolean Whether tuple1 is a superset of tuple2
      • dependsOn

        public boolean dependsOn​(Hierarchy hierarchy)
        Description copied from interface: Calc
        Returns 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
          [Measures].[Unit Sales]
          depends on all dimensions except [Measures].
        • The boolean expression
          ([Measures].[Unit Sales], [Time].[1997]) > 1000
          depends on all hierarchies except [Measures] and [Time].
        • The list expression
          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.

        Specified by:
        dependsOn in interface Calc
        Overrides:
        dependsOn in class AbstractCalc
        Parameters:
        hierarchy - Hierarchy
        Returns:
        Whether this expression's result depends upon the current member of the hierarchy
      • 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 * n

        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])

        Parameters:
        tuples - Tuples
        reader - Schema reader
        baseCubeForMeasure - 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