Github user tdas commented on a diff in the pull request:

    https://github.com/apache/spark/pull/7467#discussion_r36289821
  
    --- Diff: 
examples/src/main/java/org/apache/spark/examples/streaming/JavaDirectKafkaWordCount.java
 ---
    @@ -106,6 +111,32 @@ public Integer call(Integer i1, Integer i2) {
           });
         wordCounts.print();
     
    +    //Access the offset ranges using HasOffsetRanges
    +    // Hold a reference to the current offset ranges, so it can be used 
downstream
    +    final AtomicReference<OffsetRange[]> offsetRanges = new 
AtomicReference();
    +    messages.transformToPair(
    +        new Function<JavaPairRDD<String, String>, JavaPairRDD<String, 
String>>() {
    +            @Override
    +            public JavaPairRDD<String, String> call(JavaPairRDD<String, 
String> rdd) throws Exception {
    +            OffsetRange[] offsets = ((HasOffsetRanges) 
rdd.rdd()).offsetRanges();
    +            offsetRanges.set(offsets);
    +            return rdd;
    +            }
    +        }
    +    ).foreachRDD(
    --- End diff --
    
    @kico445 I agree with @jerryshao Could you please update the PR?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to