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

    https://github.com/apache/spark/pull/7235#discussion_r33912859
  
    --- Diff: 
external/kafka/src/main/scala/org/apache/spark/streaming/kafka/KafkaUtils.scala 
---
    @@ -403,12 +405,19 @@ object KafkaUtils {
           topicPartitions <- kc.getPartitions(topics).right
           leaderOffsets <- (if (reset == Some("smallest")) {
             kc.getEarliestLeaderOffsets(topicPartitions)
    -      } else {
    +      } else if (reset == Some("largest")){
             kc.getLatestLeaderOffsets(topicPartitions)
    +      } else {
    +        val offsets =
    +          kc.getConsumerOffsets(kafkaParams.getOrElse("group.id", ""), 
topicPartitions.seq)
    +        if(offsets.isLeft) kc.getLatestLeaderOffsets(topicPartitions)
    +        else offsets
           }).right
         } yield {
    -      val fromOffsets = leaderOffsets.map { case (tp, lo) =>
    -          (tp, lo.offset)
    +      val fromOffsets = leaderOffsets.map {
    +        case (tp, LeaderOffset(_, _, lo)) => (tp, lo)
    +        case (tp, lo: Long) => (tp, lo)
    +        case _ => throw new SparkException ("get error leader offsets ")
    --- End diff --
    
    This is not a useful exception


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