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

    https://github.com/apache/spark/pull/6632#discussion_r31769636
  
    --- Diff: 
external/kafka/src/main/scala/org/apache/spark/streaming/kafka/KafkaRDD.scala 
---
    @@ -60,6 +62,49 @@ class KafkaRDD[
         }.toArray
       }
     
    +  override def count(): Long = offsetRanges.map(_.count).sum
    --- End diff --
    
    I thought about it, and I have a little concern about this. What if someone 
create a KafkaRDD with wrong offset ranges, which does not exist. In the 
current state, count will fail which is the correct thing to do. However, with 
this patch, it will give a count which is technically incorrect, rather than 
fail. May be a good idea to validate the limits of the offset ranges, to verify 
that they exist before returning the count. And do it just once. 


---
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