How do I do that? I haven't used Scala before.

Also, linking page doesn't mention that:

http://spark.apache.org/docs/1.2.0/streaming-programming-guide.html#linking

On Tue, Mar 10, 2015 at 10:57 AM, Sean Owen <so...@cloudera.com> wrote:

> It means you do not have Scala library classes in your project classpath.
>
> On Tue, Mar 10, 2015 at 5:54 PM, Mohit Anchlia <mohitanch...@gmail.com>
> wrote:
> > I am trying out streaming example as documented and I am using spark
> 1.2.1
> > streaming from maven for Java.
> >
> > When I add this code I get compilation error on and eclipse is not able
> to
> > recognize Tuple2. I also don't see any "import scala.Tuple2" class.
> >
> >
> >
> http://spark.apache.org/docs/1.2.0/streaming-programming-guide.html#a-quick-example
> >
> >
> > private void map(JavaReceiverInputDStream<String> lines) {
> >
> > JavaDStream<String> words = lines.flatMap(
> >
> > new FlatMapFunction<String, String>() {
> >
> > @Override public Iterable<String> call(String x) {
> >
> > return Arrays.asList(x.split(" "));
> >
> > }
> >
> > });
> >
> > // Count each word in each batch
> >
> > JavaPairDStream<String, Integer> pairs = words.map(
> >
> > new PairFunction<String, String, Integer>() {
> >
> > @Override public Tuple2<String, Integer> call(String s) throws Exception
> {
> >
> > return new Tuple2<String, Integer>(s, 1);
> >
> > }
> >
> > });
> >
> > }
>

Reply via email to