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 theView
to see if the groupBy properties have been overridden.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
AggregatorUtil.IngestElementBinaryOperator
static class
AggregatorUtil.IngestPropertiesBinaryOperator
static class
AggregatorUtil.IsElementAggregated
static class
AggregatorUtil.QueryElementBinaryOperator
static class
AggregatorUtil.QueryPropertiesBinaryOperator
static class
AggregatorUtil.ToElementKey
static class
AggregatorUtil.ToIngestElementKey
A 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 class
AggregatorUtil.ToQueryElementKey
A 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 ofElement
s.static Iterable<Element>
queryAggregate(Iterable<? extends Element> elements, Schema schema, View view)
Applies query time aggregation to the provided iterable ofElement
s.static Iterable<Element>
queryAggregate(Iterable<? extends Element> elements, Schema schema, View view, boolean includeMatchedVertex)
Applies query time aggregation to the provided iterable ofElement
s.
-
-
-
Method Detail
-
ingestAggregate
public static Iterable<Element> ingestAggregate(Iterable<? extends Element> elements, Schema schema)
Applies ingest aggregation to the provided iterable ofElement
s. This uses the groupBy properties in the providedSchema
to 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 ofElement
s. This uses the groupBy properties in the providedView
orSchema
to 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 ofElement
s. This uses the groupBy properties in the providedView
orSchema
to 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.
-
-