Newer Version Available

This content describes an older version of this product. View Latest

count()

Returns the number of rows that match the query criteria.
For example, to calculate the number of carriers:
1q = foreach q generate 'carrier' as 'carrier', count() as 'count';
count() operates on the stream that is input to the group or cogroup statement. It doesn’t operate on the newly grouped stream or on an ungrouped stream.
1q = load "Carriers";
2q = group q by (Year);
3q = foreach a1 generate count(q) as countYear, count() as count, Year as year;