[ 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-unsubscr...@spark.apache.org For additional commands, e-mail: issues-h...@spark.apache.org