Skip to content

Instantly share code, notes, and snippets.

@juliensimon
Last active August 29, 2015 14:20
Show Gist options
  • Save juliensimon/94062eebc44411970582 to your computer and use it in GitHub Desktop.
Save juliensimon/94062eebc44411970582 to your computer and use it in GitHub Desktop.
Spark5.java - no lambda
PairFunction<String, String, String> keyFunc =
new PairFunction<String, String, String>() {
public Tuple2<String, String> call(String x) {
return new Tuple2<String, String>(x.split(" ")[0], x.split(" ")[1]);
}
};
JavaPairRDD<String, String> pairRDD = inputRDD.mapToPair(keyFunc);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment