You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "jweinste (JIRA)" <ji...@apache.org> on 2015/06/18 01:42:00 UTC
[jira] [Reopened] (SPARK-8412) java#KafkaUtils.createDirectStream
Java(Pair)RDDs do not implement HasOffsetRanges
[ https://issues.apache.org/jira/browse/SPARK-8412?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
jweinste reopened SPARK-8412:
-----------------------------
This is improperly implemented or improperly documented. Either way something needs to be corrected.
http://spark.apache.org/docs/latest/streaming-kafka-integration.html
You'll have to scan down to
http://spark.apache.org/docs/latest/streaming-kafka-integration.html
#tab_java_2
directKafkaStream.foreachRDD(
new Function<JavaPairRDD<String, String>, Void>() {
@Override
public Void call(JavaPairRDD<String, Integer> rdd) throws IOException {
OffsetRange[] offsetRanges = ((HasOffsetRanges)rdd).offsetRanges
// offsetRanges.length = # of Kafka partitions being consumed
...
return null;
}
}
);
> java#KafkaUtils.createDirectStream Java(Pair)RDDs do not implement HasOffsetRanges
> ----------------------------------------------------------------------------------
>
> Key: SPARK-8412
> URL: https://issues.apache.org/jira/browse/SPARK-8412
> Project: Spark
> Issue Type: Bug
> Components: Streaming
> Affects Versions: 1.3.0
> Reporter: jweinste
> Priority: Critical
>
> // Create direct kafka stream with brokers and topics
> final JavaPairInputDStream<String, String> messages = KafkaUtils.createDirectStream(jssc, String.class, String.class, StringDecoder.class,
> StringDecoder.class, kafkaParams, topics);
> messages.foreachRDD(new Function<JavaPairRDD<String, String>, Void>() {
> @Override
> public Void call(final JavaPairRDD<String, String> rdd) throws Exception {
> if (rdd instanceof HasOffsetRanges) {
> //will never happen.
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org