2 * Copyright (c) 2007 Yahoo! Inc. All rights reserved.
3 * See accompanying LICENSE file.
7 import java
.io
.IOException
;
9 import com
.yahoo
.pig
.data
.Datum
;
10 import com
.yahoo
.pig
.data
.Tuple
;
11 import com
.yahoo
.pig
.impl
.logicalLayer
.schema
.SchemaItem
;
14 * The class is used to implement functions that generate an array of Datums to represent
15 * the group of a given tuple. The group can be thought of as the "key", in Map-Reduce
18 * The programmer should not make assumptions about state maintained
19 * between invocations of the invoke() method since the Pig runtime
20 * will schedule and localize invocations based on information provided
23 * @author database-systems@yahoo.research
26 public abstract class GroupFunc
extends InstantiatedFunc
{
29 * This callback method must be implemented by all subclasses. This method
30 * defines the group that will be used by the grouping operator.
31 * Since the dataset may be divided up in a variety of ways the programmer
32 * should not make assumptions about state that is maintained between
33 * invocations of this method.
35 * @param input the tuple to be processed.
36 * @return the group that the specified tuple belongs to.
39 abstract public Datum
[] exec(Tuple input
);
41 public String
name() { return this.getClass().getName();}
43 * Returns the String representation of the function. It will
44 * have a function syntax: name(ColumnList).
46 public String
toString() {
50 public SchemaItem
outputSchema(SchemaItem input
){