There have been a number of explanations on the topic before, so I would prefer to point at one of them (or ensure we document it better), but basically all of the aggregation functions we use (sum, avg, etc) all function on bags of stuff. This is actually true in SQL as well (it just hides the "group all", but it is implied). In this case, you are grouping all of the rows together in order to run the function on them, since you cannot run a function on a relation, only on a bag. Does that make any sense? I know this is sort of an annoying nuance to understand in Pig...
2013/3/5 Eli Finkelshteyn <e...@thebackplane.com> > Yes. You can use any eval function such as SUM or AVG as long as your data > is in the format (item1, … , item, {(tup1), …(tupn)}). See > http://pig.apache.org/docs/r0.10.0/func.html#eval-functions for more info. > > On Mar 4, 2013, at 3:50 PM, Preeti Gupta wrote: > > > Hello, > > > > Can I compute SUM or AVG without using GROUPBY OR FILTER? > >