Re: I want to filter a stream by a subclass.

2014-05-21 Thread Ian Holsman
Thanks Tobias & Tathagata. these are great. On Wed, May 21, 2014 at 8:02 PM, Tobias Pfeiffer wrote: > On Thu, May 22, 2014 at 8:07 AM, Tathagata Das > wrote: > > records.filter { _.isInstanceOf[Orange] } .map { _.asInstanceOf[Orange] } > > I think a Scala-ish way would be > > records.flatMap(_

Re: I want to filter a stream by a subclass.

2014-05-21 Thread Tobias Pfeiffer
On Thu, May 22, 2014 at 8:07 AM, Tathagata Das wrote: > records.filter { _.isInstanceOf[Orange] } .map { _.asInstanceOf[Orange] } I think a Scala-ish way would be records.flatMap(_ match { case i: Int=> Some(i) case _ => None })

Re: I want to filter a stream by a subclass.

2014-05-21 Thread Tathagata Das
You could do records.filter { _.isInstanceOf[Orange] } .map { _.asInstanceOf[Orange] } On Wed, May 21, 2014 at 3:28 PM, Ian Holsman wrote: > Hi. > Firstly I'm a newb (to both Scala & Spark). > > I have a stream, that contains multiple types of records, and I would like > to create multiple st

I want to filter a stream by a subclass.

2014-05-21 Thread Ian Holsman
Hi. Firstly I'm a newb (to both Scala & Spark). I have a stream, that contains multiple types of records, and I would like to create multiple streams based on that currently I have it set up as class ALL class Orange extends ALL class Apple extends ALL now I can easily add a filter ala val reco