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

    https://github.com/apache/spark/pull/6632#discussion_r32859740
  
    --- Diff: 
external/kafka/src/main/scala/org/apache/spark/streaming/kafka/KafkaUtils.scala 
---
    @@ -158,15 +158,30 @@ object KafkaUtils {
     
       /** get leaders for the given offset ranges, or throw an exception */
       private def leadersForRanges(
    -      kafkaParams: Map[String, String],
    +      kc: KafkaCluster,
           offsetRanges: Array[OffsetRange]): Map[TopicAndPartition, (String, 
Int)] = {
    -    val kc = new KafkaCluster(kafkaParams)
         val topics = offsetRanges.map(o => TopicAndPartition(o.topic, 
o.partition)).toSet
    -    val leaders = kc.findLeaders(topics).fold(
    -      errs => throw new SparkException(errs.mkString("\n")),
    -      ok => ok
    -    )
    -    leaders
    +    val leaders = kc.findLeaders(topics)
    +    KafkaCluster.checkErrors(leaders)
    +  }
    +
    +  /** Make sure offsets are available in kafka, or throw an exception */
    +  private def checkOffsets(
    --- End diff --
    
    Those are just repeated blocks of code in KafkaUtils because it has 
duplicate constructors that are doing similar things.  I don't really feel 
they're generally useful utilities (unlike the folding / checkErrors, which 
happens in several places)


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