boolean hasPendingTransactionalOffsets(
        String groupId,
        String topic,
        int partition
    ) {
        final TimelineHashSet<Long> openTransactions = openTransactionsByGroup.get(groupId);
        if (openTransactions == null) return false;

        for (Long producerId : openTransactions) {
            Offsets offsets = pendingTransactionalOffsets.get(producerId);
            if (offsets != null && offsets.get(groupId, topic, partition) != null) {
                return true;
            }
        }

        return false;
    }
@return true iff there is at least one pending transactional offset for the given
group, topic and partition.

Package private for testing.
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/OffsetMetadataManager.java