Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Aggregators

Simple Aggregator DSL.

remarks

The methods in this class are for the most part simple factory methods for various EntryAggregator classes, but in some cases provide additional type safety. They also tend to make the code more readable, especially if imported statically, so their use is strongly encouraged in lieu of direct construction of EntryAggregator} classes.

Hierarchy

  • Aggregators

Index

Methods

Static average

  • Return an aggregator that calculates a average of the numeric values extracted from a set of entries in a Map.

    Type parameters

    • K = any

      the type of the entry's key

    • V = any

      the type of the entry's value

    Parameters

    • extractorOrProperty: ValueExtractor | string

      the extractor or method/property name to provide values for aggregation

    Returns EntryAggregator<K, V, number>

    an aggregator that calculates a average of the numeric values extracted from a set of entries in a Map

Static count

  • Return an aggregator that calculates a number of values in an entry set.

    Type parameters

    • K = any

      the type of the entry's key

    • V = any

      the type of the entry's value

    Returns EntryAggregator<K, V, number>

    an aggregator that calculates a number of values in an entry set

Static distinct

  • Return an aggregator that calculates the set of distinct values from the entries in a Map.

    Type parameters

    • K = any

    • V = any

    Parameters

    • extractorOrProperty: ValueExtractor | string

      the extractor or method/property name to provide values for aggregation

    Returns EntryAggregator<K, V, number>

    an aggregator that calculates the set of distinct values from the entries in a Map

Static groupBy

  • Return a GroupAggregator based on a specified property or method name(s) and an EntryAggregator.

    Type parameters

    • K = any

      the type of the Map entry keys

    • V = any

      the type of the Map entry values

    • T = any

      the type of the value to extract from

    • E = any

      the type of the extracted value

    • R = any

      the type of the group aggregator result

    Parameters

    • extractorOrProperty: ValueExtractor | string

      the extractor or method/property name to provide values for aggregation

    • agg: EntryAggregator<K, V, T>

      an underlying EntryAggregator

    • filter: Filter

      an optional Filter object used to filter out results of individual group aggregation results

    Returns EntryAggregator<K, V, Map<E, R>>

    a new GroupAggregator

Static max

  • Return an aggregator that calculates a maximum of the numeric values extracted from a set of entries in a Map.

    Parameters

    • extractorOrProperty: ValueExtractor | string

      the extractor or method/property name to provide values for aggregation

    Returns MaxAggregator

    an aggregator that calculates a maximum of the numeric values extracted from a set of entries in a Map

Static min

  • Return an aggregator that calculates a minimum of the numeric values extracted from a set of entries in a Map.

    Type parameters

    • K = any

      the type of the entry's key

    • V = any

      the type of the entry's value

    Parameters

    • extractorOrProperty: ValueExtractor | string

      the extractor or method/property name to provide values for aggregation

    Returns EntryAggregator<K, V, number>

    an aggregator that calculates a minimum of the numeric values extracted from a set of entries in a Map

Static priority

  • Return a new PriorityAggregator to control scheduling priority of an aggregation operation.

    Type parameters

    • K = any

      the type of the Map entry keys

    • V = any

      the type of the Map entry values

    • R = any

      the type of the final result

    Parameters

    • agg: EntryAggregator<K, V, R>

      the underlying EntryAggregator

    • Default value schedulingPriority: Schedule = aggregator.Schedule.STANDARD

      the Schedule priority

    • Default value executionTimeout: number = aggregator.Timeout.DEFAULT

      the execution Timeout

    • Default value requestTimeout: number = aggregator.Timeout.DEFAULT

      the request Timeout

    Returns PriorityAggregator<K, V, R>

Static record

  • Returns a new QueryRecorder aggregator which may be used is used to produce an object that contains an estimated or actual cost of the query execution for a given Filter.

    Type parameters

    • K = any

      the type of the Map entry keys

    • V = any

      the type of the Map entry values

    Parameters

    Returns QueryRecorder<K, V>

    a new QueryRecorder aggregator which may be used is used to produce an object that contains an estimated or actual cost of the query execution for a given Filter

Static reduce

  • Return an aggregator that will return the extracted value for each entry in the map.

    Type parameters

    • K = any

      the type of the Map entry keys

    • V = any

      the type of the Map entry values

    • E = any

      extracted value type

    • R = any

      the type of the group aggregator result

    Parameters

    • extractorOrProperty: ValueExtractor | string

      the extractor or method/property name to provide values for aggregation

    Returns ReducerAggregator<K, V, Map<K, E>>

Static script

  • script<K, V, R>(language: string, name: string, args: any[]): ScriptAggregator<K, V, R>
  • Return an aggregator that is implemented in a script using the specified language.

    Type parameters

    • K = any

      the type of the Map entry keys

    • V = any

      the type of the Map entry values

    • R = any

      the type of the group aggregator result

    Parameters

    • language: string

      the string specifying one of the supported languages

    • name: string

      the aggregator name

    • args: any[]

      arguments to pass to the aggregator

    Returns ScriptAggregator<K, V, R>

    an aggregator that is implemented in a script using the specified language

Static sum

  • Return an aggregator that calculates a sum of the numeric values extracted from a set of entries in a Map.

    Parameters

    • extractorOrProperty: ValueExtractor | string

      the extractor or method/property name to provide values for aggregation

    Returns SumAggregator

    an aggregator that calculates a sum of the numeric values extracted from a set of entries in a Map

Static top

  • Return an aggregator that aggregates the top N extracted values into an array.

    Type parameters

    • K

    • V

    • R

    Parameters

    • count: number

      the maximum number of results to include in the aggregation result

    Returns TopAggregator<K, V, R>