You are correct. This is a problem with the language. The same function means different things in different contexts with (essentially) the same kind of input.
Do you propose to fix the user confusion caused by inconsistent language constructs (aka a language defect) by an even less consistent implementation? That seems backwards to me. To fix a language defect, the language should be changed so that users get a consistent world view. Then implementations should implement that. There a bunch of different ways to fix this. Here are two. Note that neither has the benefit of more than a few seconds of thought and that thought was from a person who is not an expert (by any stretch). proposal 1) COUNT and all other scalar producing functions always return a relation with a single row and column that contains the long of interest. All operations that require a long will transparently unwrap the desired value from such singleton relations transparently. proposal 2) COUNT always returns a scalar value, but all scalar values are transparently treated as singleton relations when necessary. On Thu, Dec 11, 2008 at 12:15 PM, Santhosh Srinivasan <s...@yahoo-inc.com>wrote: > A = load 'input'; > B = COUNT(A); > C = group A by $0; > D = foreach C { X = COUNT(A); generate X:}; > > Is B a relation? > -- Ted Dunning, CTO DeepDyve 4600 Bohannon Drive, Suite 220 Menlo Park, CA 94025 www.deepdyve.com 650-324-0110, ext. 738 858-414-0013 (m)