You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by GitBox <gi...@apache.org> on 2022/03/17 02:44:32 UTC

[GitHub] [flink] syhily commented on a change in pull request #19094: [FLINK-26642][connector/pulsar] Fix support for non-partitioned topic

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: issues-unsubscribe@flink.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org