Here is the testcase, with strings as keys equijoin is returning incorrect results, but with dataframe as key it is fine, please uncomment two commented lines in code incase you want to test it with data frame as keys.
Key = c(381897554,345814151,380662040)
DCId = c(10,4905,7051)
Style = c(139139,983274,139146)
SeasonType=c("B","B","B")
AverageSeasonality=c(1.280740,1.280740,1.272458)
AverageDemand=c(5.1442942,0.2230782,0.2230782)
V1 =c(1.1689322,0.8658043,1.6103202)
histval = data.frame(Key=Key,DCId=DCId,Style=Style,SeasonType=SeasonType,AverageSeasonality=AverageSeasonality,AverageDemand=AverageDemand)
futval = data.frame(Key=Key,DCId=DCId,Style=Style,SeasonType=SeasonType,V1=V1)
futPath = to.dfs(futval)
histPath = to.dfs(histval)
mapperWithoutKeys <- function(k,v){
keyval(paste(v$Key,v$DCId,v$Style,v$SeasonType, sep="-"), v[-c(1:4)])
#keyval(data.frame(Key=v$Key,DCId=v$DCId,Style=v$Style,SeasonType = v$SeasonType),v[-c(1:4)])
}
mapper <- function(k,v){
keyval(paste(v$Key,v$DCId,v$Style,v$SeasonType, sep="-"),v)
#keyval(data.frame(Key=v$Key,DCId=v$DCId,Style=v$Style,SeasonType = v$SeasonType),v)
}
ejHist = mapreduce(input=histPath, map =mapper)
from.dfs(ejHist)
ejFut = mapreduce(input=futPath, map =mapperWithoutKeys)
from.dfs(ejFut)
reducer <- function( k, l, r){
val <- merge(l,r, by=c())
keyval(k, val)
}
ejOut = equijoin(left.input = ejHist ,right.input =ejFut , reduce =reducer)
from.dfs(ejOut)