Horia
unread,Jan 30, 2013, 6:42:27 PM1/30/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to scoobi...@googlegroups.com
What is the highest performance way to emit multiple keys from Mappers?
So far, I have the following code but am concerned that the flatten method will be too slow.
val keyList = fromTextFile(filePaths)
keyList.map( key => {
val valList = getValList(key)
val kvPairs = new Array[(String, String)](valList.length)
valList.foldLeft(0)( (idx, val) => {
kvPairs(idx) = (key, val)
idx + 1
})
kvPairs
} ).flatten
Any and all comments greatly appreciated. Thanks!