public Set<Integer> getPartitions() {
        if (!partitions.isPresent()) {
            throw new IllegalStateException(
                "Cannot list partitions of an 'all partitions' request");
        } else {
            return partitions.get();
        }
    }
If the request is for specific partitions, return the set of partitions to query.

@throws IllegalStateException if this is a request for all partitions
streams/src/main/java/org/apache/kafka/streams/query/StateQueryRequest.java