private boolean isSubset(
        List<ConsumerGroupHeartbeatRequestData.TopicPartitions> ownedTopicPartitions,
        Map<Uuid, Set<Integer>> target
    ) {
        if (ownedTopicPartitions == null) return false;

        for (ConsumerGroupHeartbeatRequestData.TopicPartitions topicPartitions : ownedTopicPartitions) {
            Set<Integer> partitions = target.get(topicPartitions.topicId());
            if (partitions == null) return false;
            for (Integer partitionId : topicPartitions.partitions()) {
                if (!partitions.contains(partitionId)) return false;
            }
        }

        return true;
    }
Verifies that the partitions currently owned by the member (the ones set in the
request) matches the ones that the member should own. It matches if the consumer
only owns partitions which are in the assigned partitions. It does not match if
it owns any other partitions.

@param ownedTopicPartitions  The partitions provided by the consumer in the request.
@param target                The partitions that the member should have.

@return A boolean indicating whether the owned partitions are a subset or not.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupMetadataManager.java