Hi, not sure what the context is but I think you can do something similar with mapPartitions:
rdd.mapPartitions { iterator => iterator.grouped(5).map { tupleGroup => emitOneRddForGroup(tupleGroup) } } The edge case is when the final grouping doesn't have exactly 5 items, if that matters. On Mon, Jun 29, 2015 at 3:57 PM, anshu shukla <anshushuk...@gmail.com> wrote: > I want to apply some logic on the basis of a FIX count of number of > tuples in each RDD . *suppose emit one rdd for every 5 tuple of > previous RDD . * > > > > -- > Thanks & Regards, > Anshu Shukla >