spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tobias Pfeiffer <...@preferred.jp>
Subject Re: convert List<String> to dstream
Date Tue, 11 Nov 2014 01:05:20 GMT
Josh,

On Tue, Nov 11, 2014 at 7:43 AM, Josh J <joshjdevl@gmail.com> wrote:
>
> I have some data generated by some utilities that returns the results as
> a List<String>. I would like to join this with a Dstream of strings. How
> can I do this? I tried the following though get scala compiler errors
>
> val list_scalaconverted =
> ssc.sparkContext.parallelize(listvalues.toArray())
>

Your `listvalues` seems to be a java.util.List, not a
scala.collection.immutable.List, right? In that case, toArray() will return
a Array[Object], not an Array[String], which leads to the error you see.
Have a look at
http://www.scala-lang.org/api/current/index.html#scala.collection.JavaConversions$
and convert your Java list to a Scala list.

Tobias

Mime
View raw message