kfaraz commented on code in PR #18466:
URL: https://github.com/apache/druid/pull/18466#discussion_r2371038407


##########
extensions-core/kafka-indexing-service/src/main/java/org/apache/druid/indexing/kafka/supervisor/KafkaSupervisor.java:
##########
@@ -130,22 +130,53 @@ public KafkaSupervisor(
   protected RecordSupplier<KafkaTopicPartition, Long, KafkaRecordEntity> 
setupRecordSupplier()
   {
     return new KafkaRecordSupplier(
-        spec.getIoConfig().getConsumerProperties(),
+        spec.getSpec().getIOConfig().getConsumerProperties(),
         sortingMapper,
-        spec.getIoConfig().getConfigOverrides(),
-        spec.getIoConfig().isMultiTopic()
+        spec.getSpec().getIOConfig().getConfigOverrides(),
+        spec.getSpec().getIOConfig().isMultiTopic()
     );
   }
 
   @Override
   protected int getTaskGroupIdForPartition(KafkaTopicPartition partitionId)
   {
-    Integer taskCount = spec.getIoConfig().getTaskCount();
+    Integer taskCount = spec.getSpec().getIOConfig().getTaskCount();
+    
+    if (spec.usePerpetuallyRunningTasks()) {
+      int taskGroupId = getRangeBasedTaskGroupId(partitionId, taskCount);
+      log.debug("Range-based assignment for partition [%s]: taskGroupId [%d] 
when taskCount is [%d]", partitionId, taskGroupId, taskCount);
+      return taskGroupId;
+    } else {
+      if (partitionId.isMultiTopicPartition()) {
+        return Math.abs(31 * partitionId.topic().hashCode() + 
partitionId.partition()) % taskCount;
+      } else {
+        return partitionId.partition() % taskCount;
+      }
+    }

Review Comment:
   Please simplify this if:
   
   ```suggestion
       if (partitionId.isMultiTopicPartition()) {
           return Math.abs(31 * partitionId.topic().hashCode() + 
partitionId.partition()) % taskCount;
         } else if (spec.usePerpetuallyRunningTasks()) {
           return getRangeBasedTaskGroupId(partitionId, taskCount);
       }  else {
           return partitionId.partition() % taskCount;
       }
   ```



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to