Package uk.gov.gchq.gaffer.store.util
Class AggregatorUtil
- java.lang.Object
-
- uk.gov.gchq.gaffer.store.util.AggregatorUtil
-
public final class AggregatorUtil extends Object
Utility methods to help with doing aggregation of elements. Aggregation differs depending on if it ingest or query time aggregation. Ingest aggregation uses the groupBy properties in aSchema, whereas query time aggregation first checks theViewto see if the groupBy properties have been overridden.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classAggregatorUtil.IngestElementBinaryOperatorstatic classAggregatorUtil.IngestPropertiesBinaryOperatorstatic classAggregatorUtil.IsElementAggregatedstatic classAggregatorUtil.QueryElementBinaryOperatorstatic classAggregatorUtil.QueryPropertiesBinaryOperatorstatic classAggregatorUtil.ToElementKeystatic classAggregatorUtil.ToIngestElementKeyA Function that takes and element as input and outputs an element key that consists of the Group-by values in theSchema, the Identifiers and the Group.static classAggregatorUtil.ToQueryElementKeyA Function that takes and element as input and outputs an element key that consists of the Group-by values in theView, the Identifiers and the Group.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static Set<String>getIngestGroupBy(String group, Schema schema)static Map<String,Set<String>>getIngestGroupBys(Schema schema)static Set<String>getQueryGroupBy(String group, Schema schema, View view)static Map<String,Set<String>>getQueryGroupBys(Schema schema, View view)static Iterable<Element>ingestAggregate(Iterable<? extends Element> elements, Schema schema)Applies ingest aggregation to the provided iterable ofElements.static Iterable<Element>queryAggregate(Iterable<? extends Element> elements, Schema schema, View view)Applies query time aggregation to the provided iterable ofElements.static Iterable<Element>queryAggregate(Iterable<? extends Element> elements, Schema schema, View view, boolean includeMatchedVertex)Applies query time aggregation to the provided iterable ofElements.
-
-
-
Method Detail
-
ingestAggregate
public static Iterable<Element> ingestAggregate(Iterable<? extends Element> elements, Schema schema)
Applies ingest aggregation to the provided iterable ofElements. This uses the groupBy properties in the providedSchemato group the elements prior to aggregating them.NOTE - this is done in memory so the size of the iterable should be limited.
- Parameters:
elements- the elements to be aggregatedschema- the schema containing the aggregators and groupBy properties to use- Returns:
- the aggregated elements.
-
queryAggregate
public static Iterable<Element> queryAggregate(Iterable<? extends Element> elements, Schema schema, View view)
Applies query time aggregation to the provided iterable ofElements. This uses the groupBy properties in the providedVieworSchemato group the elements prior to aggregating them. The Matched Vertex field is ignored during aggregation.NOTE - this is done in memory so the size of the iterable should be limited.
- Parameters:
elements- the elements to be aggregatedschema- the schema containing the aggregators and groupBy properties to useview- the view containing the aggregators and groupBy properties to use- Returns:
- the aggregated elements.
-
queryAggregate
public static Iterable<Element> queryAggregate(Iterable<? extends Element> elements, Schema schema, View view, boolean includeMatchedVertex)
Applies query time aggregation to the provided iterable ofElements. This uses the groupBy properties in the providedVieworSchemato group the elements prior to aggregating them. Aggregation of Edges can optionally be configured to include the Matched Vertex field.NOTE - this is done in memory so the size of the iterable should be limited.
- Parameters:
elements- the elements to be aggregatedschema- the schema containing the aggregators and groupBy properties to useview- the view containing the aggregators and groupBy properties to useincludeMatchedVertex- whether aggregation groups should include the Edge Matched Vertex- Returns:
- the aggregated elements.
-
-