spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From im281 <iman.mohtash...@gmail.com>
Subject flatmap pair
Date Fri, 09 Dec 2016 03:11:22 GMT

The class 'Detector' has a function 'detectFeature(cluster) 
However, the method has changed to return a list of features as opposed to
one feature as it is below.
How do I change this so it returns a list of feature objects instead


// creates key-value pairs for Isotope cluster ID and Isotope cluster
		// groups them by keys and passes
		// each collection of isotopes to the feature detector
		JavaPairRDD<String, String> features =
scans.flatMapToPair(keyData).groupByKey().mapValues(values -> {

			System.out.println("Inside Feature Detection Reduce !");
			Detector d = new Detector();
			ArrayList<IsotopeCluster> clusters = (ArrayList<IsotopeCluster>)
StreamSupport
					.stream(values.spliterator(),
false).map(d::GetClustersfromKey).collect(Collectors.toList());
			return d.WriteFeatureValue(d.DetectFeature(clusters));
		});



--
View this message in context: http://apache-spark-user-list.1001560.n3.nabble.com/flatmap-pair-tp28187.html
Sent from the Apache Spark User List mailing list archive at Nabble.com.

---------------------------------------------------------------------
To unsubscribe e-mail: user-unsubscribe@spark.apache.org


Mime
View raw message