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

    https://github.com/apache/spark/pull/17752#discussion_r113075117
  
    --- Diff: 
external/kafka-0-10-sql/src/main/scala/org/apache/spark/sql/kafka010/KafkaSourceRDD.scala
 ---
    @@ -125,16 +125,15 @@ private[kafka010] class KafkaSourceRDD(
           context: TaskContext): Iterator[ConsumerRecord[Array[Byte], 
Array[Byte]]] = {
         val sourcePartition = thePart.asInstanceOf[KafkaSourceRDDPartition]
         val topic = sourcePartition.offsetRange.topic
    -    if (!reuseKafkaConsumer) {
    -      // if we can't reuse CachedKafkaConsumers, let's reset the groupId 
to something unique
    -      // to each task (i.e., append the task's unique partition id), 
because we will have
    -      // multiple tasks (e.g., in the case of union) reading from the same 
topic partitions
    -      val old = 
executorKafkaParams.get(ConsumerConfig.GROUP_ID_CONFIG).asInstanceOf[String]
    -      val id = TaskContext.getPartitionId()
    -      executorKafkaParams.put(ConsumerConfig.GROUP_ID_CONFIG, old + "-" + 
id)
    -    }
         val kafkaPartition = sourcePartition.offsetRange.partition
    -    val consumer = CachedKafkaConsumer.getOrCreate(topic, kafkaPartition, 
executorKafkaParams)
    +    val consumer =
    +      if (!reuseKafkaConsumer) {
    +        // If we can't reuse CachedKafkaConsumers, creating a new 
CachedKafkaConsumer. As here we
    +        // uses `assign`, we don't need to worry about the "group.id" 
conflicts.
    +        new CachedKafkaConsumer(new TopicPartition(topic, kafkaPartition), 
executorKafkaParams)
    --- End diff --
    
    This is the major change.


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