@ Override public boolean next ( ) { if ( ! moreGroups ) return false ; if ( aggFns != null ) for ( AggregationFn fn : aggFns ) fn . processFirst ( ss ) ; groupVal = new GroupValue ( ss , groupFlds ) ; while ( moreGroups = ss . next ( ) ) { GroupValue gv = new GroupValue ( ss , groupFlds ) ; if ( ! groupVal . equals ( gv ) ) break ; if ( aggFns != null ) for ( AggregationFn fn : aggFns ) fn . processNext ( ss ) ; } return true ; }
Moves to the next group . The key of the group is determined by the group values at the current record . The method repeatedly reads underlying records until it encounters a record having a different key . The aggregation functions are called for each record in the group . The values of the grouping fields for the group are saved .