Example Page Java Function2

2015-06-03 Thread linkstar350 .
Hi, I'm Taira.

I notice that this example page may be a mistake.

https://spark.apache.org/examples.html


Word Count (Java)

JavaRDDString textFile = spark.textFile(hdfs://...);
JavaRDDString words = textFile.flatMap(new FlatMapFunctionString, String() {
  public IterableString call(String s) { return Arrays.asList(s.split( )); }
});
JavaPairRDDString, Integer pairs = words.mapToPair(new
PairFunctionString, String, Integer() {
  public Tuple2String, Integer call(String s) { return new
Tuple2String, Integer(s, 1); }
});
JavaPairRDDString, Integer counts = pairs.reduceByKey(new
Function2Integer, Integer() {
  public Integer call(Integer a, Integer b) { return a + b; }
});
counts.saveAsTextFile(hdfs://...);


Function2 should have three generic type arguments, but there are only two.

I hope for your consideration.

Taira

-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org



Re: Example Page Java Function2

2015-06-03 Thread linkstar350 .
Thank you. I confirmed the page.

2015-06-04 1:35 GMT+09:00 Sean Owen so...@cloudera.com:
 Yes, I think you're right. Since this is a change to the ASF hosted
 site, I can make this change to the .md / .html directly rather than
 go through the usual PR.

 On Wed, Jun 3, 2015 at 6:23 PM, linkstar350 . tweicomepan...@gmail.com 
 wrote:
 Hi, I'm Taira.

 I notice that this example page may be a mistake.

 https://spark.apache.org/examples.html

 
 Word Count (Java)

 JavaRDDString textFile = spark.textFile(hdfs://...);
 JavaRDDString words = textFile.flatMap(new FlatMapFunctionString, 
 String() {
   public IterableString call(String s) { return Arrays.asList(s.split( 
 )); }
 });
 JavaPairRDDString, Integer pairs = words.mapToPair(new
 PairFunctionString, String, Integer() {
   public Tuple2String, Integer call(String s) { return new
 Tuple2String, Integer(s, 1); }
 });
 JavaPairRDDString, Integer counts = pairs.reduceByKey(new
 Function2Integer, Integer() {
   public Integer call(Integer a, Integer b) { return a + b; }
 });
 counts.saveAsTextFile(hdfs://...);
 

 Function2 should have three generic type arguments, but there are only two.

 I hope for your consideration.

 Taira

 -
 To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
 For additional commands, e-mail: user-h...@spark.apache.org


-
To unsubscribe, e-mail: user-unsubscr...@spark.apache.org
For additional commands, e-mail: user-h...@spark.apache.org