Aggregator

class Aggregator[source]

Bases: Generic[AggregatorResultType]

Marker base class for all aggregators.

Aggregators allow computing a value of some function (e.g sum or max) over the stored map entries. The computation is performed in a fully distributed manner, so no data other than the computed value is transferred to the client, making the computation fast.

count(attribute_path: str = None) Aggregator[int][source]

Creates an aggregator that counts the input values.

Accepts None input values and None extracted values.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that counts the input values.

distinct(attribute_path: str = None) Aggregator[Set[AggregatorResultType]][source]

Creates an aggregator that calculates the distinct set of input values.

Accepts None input values and None extracted values.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the distinct set of input values.

double_avg(attribute_path: str = None) Aggregator[float][source]

Creates an aggregator that calculates the average of the input values.

Does NOT accept None input values or None extracted values.

Since the server-side implementation is in Java, values stored in the Map must be of type double (primitive or boxed) in Java or of a type that can be converted to that. That means, one should be able to use this aggregator with float or int values sent from the Python client unless they are out of range for double type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the average of the input values.

double_sum(attribute_path: str = None) Aggregator[float][source]

Creates an aggregator that calculates the sum of the input values.

Does NOT accept None input values or None extracted values.

Since the server-side implementation is in Java, values stored in the Map must be of type double (primitive or boxed) in Java or of a type that can be converted to that. That means, one should be able to use this aggregator with float or int values sent from the Python client unless they are out of range for double type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the sum of the input values.

fixed_point_sum(attribute_path: str = None) Aggregator[int][source]

Creates an aggregator that calculates the sum of the input values.

Does NOT accept None input values or None extracted values.

Accepts generic number input values. That means, one should be able to use this aggregator with float or int value sent from the Python client unless they are out of range for long type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the sum of the input values.

floating_point_sum(attribute_path: str = None) Aggregator[float][source]

Creates an aggregator that calculates the sum of the input values.

Does NOT accept None input values or None extracted values.

Accepts generic number input values. That means, one should be able to use this aggregator with float or int value sent from the Python client unless they are out of range for double type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the sum of the input values.

int_avg(attribute_path: str = None) Aggregator[int][source]

Creates an aggregator that calculates the average of the input values.

Does NOT accept None input values or None extracted values.

Since the server-side implementation is in Java, values stored in the Map must be of type int (primitive or boxed) in Java or of a type that can be converted to that. That means, one should be able to use this aggregator with int values sent from the Python client unless they are out of range for int type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the average of the input values.

int_sum(attribute_path: str = None) Aggregator[int][source]

Creates an aggregator that calculates the sum of the input values.

Does NOT accept None input values or None extracted values.

Since the server-side implementation is in Java, values stored in the Map must be of type int (primitive or boxed) in Java or of a type that can be converted to that. That means, one should be able to use this aggregator with int values sent from the Python client unless they are out of range for int type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the sum of the input values.

long_avg(attribute_path: str = None) Aggregator[int][source]

Creates an aggregator that calculates the average of the input values.

Does NOT accept None input values or None extracted values.

Since the server-side implementation is in Java, values stored in the Map must be of type long (primitive or boxed) in Java or of a type that can be converted to that. That means, one should be able to use this aggregator with int values sent from the Python client unless they are out of range for long type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the average of the input values.

long_sum(attribute_path: str = None) Aggregator[int][source]

Creates an aggregator that calculates the sum of the input values.

Does NOT accept None input values or None extracted values.

Since the server-side implementation is in Java, values stored in the Map must be of type long (primitive or boxed) in Java or of a type that can be converted to that. That means, one should be able to use this aggregator with int values sent from the Python client unless they are out of range for long type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the sum of the input values.

max_(attribute_path: str = None) Aggregator[AggregatorResultType][source]

Creates an aggregator that calculates the max of the input values.

Accepts None input values and None extracted values.

Since the server-side implementation is in Java, values stored in the Map must implement the Comparable interface in Java. That means, one should be able to use this aggregator with most of the primitive values sent from the Python client, as Java implements this interface for the equivalents of types like int, str, and float.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the max of the input values.

min_(attribute_path: str = None) Aggregator[AggregatorResultType][source]

Creates an aggregator that calculates the min of the input values.

Accepts None input values and None extracted values.

Since the server-side implementation is in Java, values stored in the Map must implement the Comparable interface in Java. That means, one should be able to use this aggregator with most of the primitive values sent from the Python client, as Java implements this interface for the equivalents of types like int, str, and float.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the min of the input values.

number_avg(attribute_path: str = None) Aggregator[float][source]

Creates an aggregator that calculates the average of the input values.

Does NOT accept None input values or None extracted values.

Accepts generic number input values. That means, one should be able to use this aggregator with float or int value sent from the Python client unless they are out of range for double type in Java.

Parameters:

attribute_path – Extracts values from this path, if given.

Returns:

An aggregator that calculates the average of the input values.

max_by(attribute_path: str) Aggregator[MapEntry[KeyType, ValueType]][source]

Creates an aggregator that calculates the max of the input values extracted from the given attribute_path and returns the input item containing the maximum value. If multiple items contain the maximum value, any of them is returned.

Accepts None input values and None extracted values.

Since the server-side implementation is in Java, values stored in the Map must implement the Comparable interface in Java. That means, one should be able to use this aggregator with most of the primitive values sent from the Python client, as Java implements this interface for the equivalents of types like int, str, and float.

Parameters:

attribute_path – Path to extract values from.

Returns:

An aggregator that calculates the input value containing the maximum value extracted from the path.

min_by(attribute_path: str) Aggregator[MapEntry[KeyType, ValueType]][source]

Creates an aggregator that calculates the min of the input values extracted from the given attribute_path and returns the input item containing the minimum value. If multiple items contain the minimum value, any of them is returned.

Accepts None input values and None extracted values.

Since the server-side implementation is in Java, values stored in the Map must implement the Comparable interface in Java. That means, one should be able to use this aggregator with most of the primitive values sent from the Python client, as Java implements this interface for the equivalents of types like int, str, and float.

Parameters:

attribute_path – Path to extract values from.

Returns:

An aggregator that calculates the input value containing the minimum value extracted from the path.