count() Function Takes Grouped Source Stream as an Argument

The count() function operates on streams that were inputs to the group or cogroup statements. It doesn’t operate on the newly grouped stream or on an ungrouped stream.
Important

Important

This change may break existing SAQL code. Update existing code to use this new behavior.

The count() function operates on the stream a that group operated on:
a = load "0Fbxx000000002qCAA/0Fcxx000000002WCAQ";
a1 = group a by (Year);
q = foreach a1 generate count(a) as countYear, count() as count, Year as year;
q = limit q 20;
Note

Note

The source stream argument can be grouped or cogrouped.

In the previous release, you could also pass a1 to count(), but this example now throws an error:
a = load "0Fbxx000000002qCAA/0Fcxx000000002WCAQ";
a1 = group a by (Year);
q = foreach a1 generate count(a1) as countYear, count() as count, Year as year;
q = limit q 20;
Tip

Tip

You can still use count() with no arguments on ungrouped data.