protected Map<String, Integer> getNumPartitions(final Set<String> topics,
                                                    final Set<String> tempUnknownTopics) {
        log.debug("Trying to check if topics {} have been created with expected number of partitions.", topics);

        final Map<String, List<TopicPartitionInfo>> topicPartitionInfo = getTopicPartitionInfo(topics, tempUnknownTopics);
        return topicPartitionInfo.entrySet().stream().collect(Collectors.toMap(
            Entry::getKey, e -> e.getValue().size()));
    }
Try to get the number of partitions for the given topics; return the number of partitions for topics that already exists.

Topics that were not able to get its description will simply not be returned
streams/src/main/java/org/apache/kafka/streams/processor/internals/InternalTopicManager.java