@rajat puchnanda
Method 1:
You can use Query record processor and add new dynamic property with value as sql query like
select id,count(*) from flowfile group by id
and the processor will run the sql query on the flowfile content then gives the result as output flowfile.
Refer to this link to get more details regarding configuration of Query Record processor.
Method2:
If you are thinking to Group by all like records then you can use Partition Record processor and specify the record path that you want to group by then the processor will groups all the like records into inidividual groups.
Refer to this link to get more details regarding configuration of Partition Record processor.