public Set<String> getTopicPartitions() throws PulsarClientException {
        List<String> topics = getTopics();
        HashSet<String> allTopics = new HashSet<>();
        for (String topic : topics) {
            int partNum = 1;
            try {
                List<String> partitions = client.getPartitionsForTopic(topic).get();
                if (partitions.size() == 1 && partitions.get(0).equals(topic)) {
                    partNum = 0;
                } else {
                    partNum = partitions.size();
                }
            } catch (ExecutionException | InterruptedException e) {
                // TODO:here topic not found must not be wait forever, otherwise is a bug!
                log.info("topic<{}> is not exit or execute error.", topic, e);
                throw new PulsarClientException(e);
            }
            // pulsar still has the situation of getting 0 partitions, non-partitions topic.
            if (partNum == 0) {
                allTopics.add(topic);
            } else {
                for (int i = 0; i < partNum; i++) {
                    allTopics.add(topic + PulsarOptions.PARTITION_SUFFIX + i);
                }
            }
        }
        return allTopics;
    }
Get topic partitions all. If the topic does not exist, it is created automatically

@return allTopicPartitions
@throws PulsarAdminException pulsarAdminException
inlong-sort/sort-flink/sort-flink-v1.13/sort-connectors/pulsar/src/main/java/org/apache/inlong/sort/pulsar/internal/PulsarMetadataReader.java