implement mapPartitionsToPairWithContext by wrap mapPartitionsWithContext.