Count per group
groupBy defines groups by key; agg returns one row per group. The example counts lines for each product. Desk lamp appears on three lines, but those lines contain six units: a line count is not a quantity sum. orderBy makes the output deterministic.