Re: Reading a text file into RDD[Char] instead of RDD[String]

2015-03-19 Thread Manoj Awasthi
sc.textFile().flatMap(_.toIterator)

On Thu, Mar 19, 2015 at 6:31 PM, Sean Owen  wrote:

> val s = sc.parallelize(Array("foo", "bar", "baz"))
>
> val c = s.flatMap(_.toIterator)
>
> c.collect()
> res8: Array[Char] = Array(f, o, o, b, a, r, b, a, z)
>
> On Thu, Mar 19, 2015 at 8:46 AM, Michael Lewis  wrote:
> > Hi,
> >
> > I’m struggling to think of the best way to read a text file into an
> RDD[Char] rather than [String]
> >
> > I can do:
> >
> > sc.textFile(….)  which gives me the Rdd[String],
> >
> > Can anyone suggest the most efficient way to create the RDD[Char] ? I’m
> sure I’ve missed something simple…
> >
> > Regards,
> > Mike
> > -
> > 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
>
>


Re: Reading a text file into RDD[Char] instead of RDD[String]

2015-03-19 Thread Sean Owen
val s = sc.parallelize(Array("foo", "bar", "baz"))

val c = s.flatMap(_.toIterator)

c.collect()
res8: Array[Char] = Array(f, o, o, b, a, r, b, a, z)

On Thu, Mar 19, 2015 at 8:46 AM, Michael Lewis  wrote:
> Hi,
>
> I’m struggling to think of the best way to read a text file into an RDD[Char] 
> rather than [String]
>
> I can do:
>
> sc.textFile(….)  which gives me the Rdd[String],
>
> Can anyone suggest the most efficient way to create the RDD[Char] ? I’m sure 
> I’ve missed something simple…
>
> Regards,
> Mike
> -
> 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