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

    https://github.com/apache/spark/pull/16686#discussion_r99193469
  
    --- Diff: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaSourceRDD.scala
 ---
    @@ -135,7 +136,28 @@ private[kafka010] class KafkaSourceRDD(
         } else {
           new NextIterator[ConsumerRecord[Array[Byte], Array[Byte]]]() {
             val consumer = CachedKafkaConsumer.getOrCreate(
    -          range.topic, range.partition, executorKafkaParams)
    +            range.topic, range.partition, executorKafkaParams, 
reuseKafkaConsumer)
    +        if (range.fromOffset < 0 || range.untilOffset < 0) {
    --- End diff --
    
    nit: Does this piece of code need to resolve the range need to be inside 
the NextIterator? This is cause a lot of unnecessary nesting. Instead of making 
the range var, you can resolve the range above and then create the NextIterator.
    
    Furthermore, why use rawConsumer directly and expose it? Why not use 
`CachedKafkaConsumer.getAvailableOffsetRange()`?


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to