syhily commented on a change in pull request #19094:
URL: https://github.com/apache/flink/pull/19094#discussion_r828707387



##########
File path: 
flink-connectors/flink-connector-pulsar/src/main/java/org/apache/flink/connector/pulsar/sink/writer/topic/TopicMetadataListener.java
##########
@@ -115,8 +117,14 @@ public void open(SinkConfiguration sinkConfiguration, 
ProcessingTimeService time
                 && (!partitionedTopics.isEmpty() || !topicMetadata.isEmpty())) 
{
             List<String> results = new ArrayList<>();
             for (Map.Entry<String, Integer> entry : topicMetadata.entrySet()) {
-                for (int i = 0; i < entry.getValue(); i++) {
-                    results.add(topicNameWithPartition(entry.getKey(), i));
+                int partitionNums = entry.getValue();
+                // Get all topics from partitioned and non-partitioned topic 
names
+                if (partitionNums == NON_PARTITIONED) {
+                    results.add(topicNameWithNonPartition(entry.getKey()));
+                } else {
+                    for (int i = 0; i < entry.getValue(); i++) {

Review comment:
       `for (int i = 0; i < partitionNums; i++) {`




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