Aggregate

See javadoc - uk.gov.gchq.gaffer.operation.impl.function.Aggregate

Available since Gaffer version 1.0.0

The Aggregate operation would normally be used in an Operation Chain to aggregate the results of a previous operation.

Required fields

No required fields

Examples

Simple aggregate elements example

Java
JSON
Full JSON
Python
final Aggregate aggregate = new Aggregate();
{
  "class" : "Aggregate"
}
{
  "class" : "uk.gov.gchq.gaffer.operation.impl.function.Aggregate"
}
g.Aggregate()


Aggregate only edges of type edge with a transient property and provided aggregator

The groupBy has been set to an empty array. This will override the groupBy value in the schema.

Java
JSON
Full JSON
Python
final String[] groupBy = {};
final Aggregate aggregate = new Aggregate.Builder()
        .edge("edge", new AggregatePair(
                groupBy,
                new ElementAggregator.Builder()
                        .select("transientProperty1")
                        .execute(new StringConcat())
                        .build()))
        .build();
{
  "class" : "Aggregate",
  "edges" : {
    "edge" : {
      "elementAggregator" : {
        "operators" : [ {
          "selection" : [ "transientProperty1" ],
          "binaryOperator" : {
            "class" : "StringConcat",
            "separator" : ","
          }
        } ]
      },
      "groupBy" : [ ]
    }
  }
}
{
  "class" : "uk.gov.gchq.gaffer.operation.impl.function.Aggregate",
  "edges" : {
    "edge" : {
      "elementAggregator" : {
        "operators" : [ {
          "selection" : [ "transientProperty1" ],
          "binaryOperator" : {
            "class" : "uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat",
            "separator" : ","
          }
        } ]
      },
      "groupBy" : [ ]
    }
  }
}
g.Aggregate( 
  edges=[ 
    g.AggregatePair( 
      element_aggregator=g.ElementAggregateDefinition( 
        operators=[ 
          g.BinaryOperatorContext( 
            binary_operator=g.BinaryOperator( 
              class_name="uk.gov.gchq.koryphe.impl.binaryoperator.StringConcat", 
              fields={'separator': ','} 
            ), 
            selection=[ 
              "transientProperty1" 
            ] 
          ) 
        ] 
      ), 
      group="edge", 
      group_by=[ 
      ] 
    ) 
  ] 
)


results matching ""

    No results matching ""