dlg99 commented on code in PR #19923:
URL: https://github.com/apache/pulsar/pull/19923#discussion_r1149904332


##########
pulsar-io/kafka-connect-adaptor/src/main/java/org/apache/pulsar/io/kafka/connect/KafkaConnectSink.java:
##########
@@ -417,8 +421,19 @@ static BatchMessageSequenceRef 
getMessageSequenceRefForBatchMessage(MessageId me
 
     @SuppressWarnings("rawtypes")
     protected SinkRecord toSinkRecord(Record<GenericObject> sourceRecord) {
-        final int partition = sourceRecord.getPartitionIndex().orElse(0);
-        final String topic = 
sanitizeNameIfNeeded(sourceRecord.getTopicName().orElse(topicName), 
sanitizeTopicName);
+        final int partition;
+        final String topic;
+
+        if (collapsePartitionedTopics
+                && sourceRecord.getTopicName().isPresent()
+                && 
TopicName.get(sourceRecord.getTopicName().get()).isPartitioned()) {

Review Comment:
   TopicName.get caches internally and this way I don't need to deal with "if 
not partitioned" case (and don't have to call it if collapsePartitionedTopics 
is disabled)



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

Reply via email to