use new foreachPartitionWithIndex , avoid useless foreach after map