You can also union multiple DstreamRDDs in this way 
DstreamRDD1.union(DstreamRDD2).union(DstreamRDD3)  etc etc

 

Ps: the API is not “redundant” it offers several ways for achivieving the same 
thing as a convenience depending on the situation 

 

From: Vadim Bichutskiy [mailto:vadim.bichuts...@gmail.com] 
Sent: Tuesday, May 12, 2015 5:37 PM
To: Saisai Shao
Cc: user@spark.apache.org
Subject: Re: DStream Union vs. StreamingContext Union

 

Thanks Saisai. That makes sense. Just seems redundant to have both.

  
<https://mailfoogae.appspot.com/t?sender=admFkaW0uYmljaHV0c2tpeUBnbWFpbC5jb20%3D&type=zerocontent&guid=7c28f88f-f212-4811-a16e-e8b21035b172>
 ᐧ

  
<http://t.signauxcinq.com/e1t/o/5/f18dQhb0S7ks8dDMPbW2n0x6l2B9gXrN7sKj6v5dsrxW7gbZX-8q-6ZdVdnPvF2zlZNzW3hF9wD1k1H6H0?si=5533377798602752&pi=f69cba48-f231-4547-c8f2-f3c49da3771d>
 

 

On Mon, May 11, 2015 at 10:36 PM, Saisai Shao <sai.sai.s...@gmail.com> wrote:

DStream.union can only union two DStream, one is itself. While 
StreamingContext.union can union an array of DStreams, internally DStream.union 
is a special case of StreamingContext.union:

 

def union(that: DStream[T]): DStream[T] = new UnionDStream[T](Array(this, that))

 

So there's no difference, if you want to union more than two DStreams, just use 
the one in StreamingContext, otherwise, both two APIs are fine.

 

 

2015-05-12 6:49 GMT+08:00 Vadim Bichutskiy <vadim.bichuts...@gmail.com>:

Can someone explain to me the difference between DStream union and 
StreamingContext union? 

When do you use one vs the other?

 

Thanks,

Vadim

  
<https://mailfoogae.appspot.com/t?sender=admFkaW0uYmljaHV0c2tpeUBnbWFpbC5jb20%3D&type=zerocontent&guid=6cd729de-8339-40af-b2c5-b249011d6c3e>
 ᐧ

 

 

Reply via email to