JavaPairRDD<Object, Query> indexedQueries) {
return model.temperatures.join(indexedQueries.mapToPair(
new PairFunction<Tuple2<Object, Query>, String, Object>() {
@Override // reverse the query tuples, then join
public Tuple2 call(Tuple2<Object, Query> tuple) {
return new Tuple2(tuple._2.day, tuple._1);
}
})).mapToPair(
new PairFunction<Tuple2<String, Tuple2<Float, Object>>, Object, Float>() {
@Override // map result back to predictions, dropping the day
public Tuple2 call(Tuple2<String, Tuple2<Float, Object>> tuple) {
return new Tuple2(tuple._2._2, tuple._2._1);
}
});
}