You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by Mikael Ståldal <mi...@magine.com> on 2016/07/08 09:42:08 UTC

Why is KafkaUtils.createRDD offsetRanges an Array rather than a Seq?

Is there any particular reason for the offsetRanges parameter to
KafkaUtils.createRDD is Array[OffsetRange]? Why not Seq[OffsetRange]?

http://spark.apache.org/docs/latest/api/scala/org/apache/spark/streaming/kafka/KafkaUtils$.html

https://github.com/apache/spark/blob/master/external/kafka-0-8/src/main/scala/org/apache/spark/streaming/kafka/KafkaUtils.scala#L248

-- 
[image: MagineTV]

*Mikael Ståldal*
Senior software developer

*Magine TV*
mikael.staldal@magine.com
Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com

Privileged and/or Confidential Information may be contained in this
message. If you are not the addressee indicated in this message
(or responsible for delivery of the message to such a person), you may not
copy or deliver this message to anyone. In such case,
you should destroy this message and kindly notify the sender by reply
email.

Re: Why is KafkaUtils.createRDD offsetRanges an Array rather than a Seq?

Posted by Cody Koeninger <co...@koeninger.org>.
Yeah, it's a reasonable lowest common denominator between java and scala,
and what's passed to that convenience constructor is actually what's used
to construct the class.

FWIW, in the 0.10 direct stream api when there's unavoidable wrapping /
conversion anyway (since the underlying class takes a
java.util.Collection), the Scala convenience methods take an Iterable.

On Fri, Jul 8, 2016 at 5:55 AM, Sean Owen <so...@cloudera.com> wrote:

> Java-friendliness is the usual reason, though I don't know if that's the
> reason here.
>
> On Fri, Jul 8, 2016 at 10:42 AM, Mikael Ståldal <mikael.staldal@magine.com
> > wrote:
>
>> Is there any particular reason for the offsetRanges parameter to
>> KafkaUtils.createRDD is Array[OffsetRange]? Why not Seq[OffsetRange]?
>>
>>
>> http://spark.apache.org/docs/latest/api/scala/org/apache/spark/streaming/kafka/KafkaUtils$.html
>>
>>
>> https://github.com/apache/spark/blob/master/external/kafka-0-8/src/main/scala/org/apache/spark/streaming/kafka/KafkaUtils.scala#L248
>>
>> --
>> [image: MagineTV]
>>
>> *Mikael Ståldal*
>> Senior software developer
>>
>> *Magine TV*
>> mikael.staldal@magine.com
>> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>>
>> Privileged and/or Confidential Information may be contained in this
>> message. If you are not the addressee indicated in this message
>> (or responsible for delivery of the message to such a person), you may
>> not copy or deliver this message to anyone. In such case,
>> you should destroy this message and kindly notify the sender by reply
>> email.
>>
>
>

Re: Why is KafkaUtils.createRDD offsetRanges an Array rather than a Seq?

Posted by Sean Owen <so...@cloudera.com>.
Java-friendliness is the usual reason, though I don't know if that's the
reason here.

On Fri, Jul 8, 2016 at 10:42 AM, Mikael Ståldal <mi...@magine.com>
wrote:

> Is there any particular reason for the offsetRanges parameter to
> KafkaUtils.createRDD is Array[OffsetRange]? Why not Seq[OffsetRange]?
>
>
> http://spark.apache.org/docs/latest/api/scala/org/apache/spark/streaming/kafka/KafkaUtils$.html
>
>
> https://github.com/apache/spark/blob/master/external/kafka-0-8/src/main/scala/org/apache/spark/streaming/kafka/KafkaUtils.scala#L248
>
> --
> [image: MagineTV]
>
> *Mikael Ståldal*
> Senior software developer
>
> *Magine TV*
> mikael.staldal@magine.com
> Grev Turegatan 3  | 114 46 Stockholm, Sweden  |   www.magine.com
>
> Privileged and/or Confidential Information may be contained in this
> message. If you are not the addressee indicated in this message
> (or responsible for delivery of the message to such a person), you may not
> copy or deliver this message to anyone. In such case,
> you should destroy this message and kindly notify the sender by reply
> email.
>