Group Functions
A Group Function assigns tuples to group(s) (note: if desired, a tuple can be assigned to multiple groups).
To create your own Group Function, create a Java class that extends the following abstract class:
public abstract class GroupFunc{
/**
* @param input the tuple to be processed.
* @return the different groups that the specified tuple belongs to.
* @throws IOException
*/
abstract public Datum[] exec(Tuple input);
}
Example
Our built-in GFAll() function puts all tuples into a single group labeled "all". The code is:
public class GFAll extends GroupFunc {
public Datum[] exec(Tuple input) {
return new Datum[]{new DataAtom("all")};
}
}
Advanced Features
As in EvalFunction, Group functions can define the schema of their output by overriding the outputSchema method.
As in EvalFunction, Group functions can perform some final cleanup by overriding the finish method.