private Map<String, Map<TopicPartition, OffsetAndMetadata>> parseResetPlan(String resetPlanCsv) {
            ObjectReader csvReader = CsvUtils.readerFor(CsvUtils.CsvRecordNoGroup.class);
            String[] lines = resetPlanCsv.split("\n");
            boolean isSingleGroupQuery = opts.options.valuesOf(opts.groupOpt).size() == 1;
            boolean isOldCsvFormat = false;
            try {
                if (lines.length > 0) {
                    csvReader.readValue(lines[0], CsvUtils.CsvRecordNoGroup.class);
                    isOldCsvFormat = true;
                }
            } catch (IOException e) {
                e.printStackTrace();
                // Ignore.
            }

            Map<String, Map<TopicPartition, OffsetAndMetadata>> dataMap = new HashMap<>();

            try {
                // Single group CSV format: "topic,partition,offset"
                if (isSingleGroupQuery && isOldCsvFormat) {
                    String group = opts.options.valueOf(opts.groupOpt);
                    for (String line : lines) {
                        CsvUtils.CsvRecordNoGroup rec = csvReader.readValue(line, CsvUtils.CsvRecordNoGroup.class);
                        dataMap.computeIfAbsent(group, k -> new HashMap<>())
                            .put(new TopicPartition(rec.getTopic(), rec.getPartition()), new OffsetAndMetadata(rec.getOffset()));
                    }
                } else {
                    csvReader = CsvUtils.readerFor(CsvUtils.CsvRecordWithGroup.class);
                    for (String line : lines) {
                        CsvUtils.CsvRecordWithGroup rec = csvReader.readValue(line, CsvUtils.CsvRecordWithGroup.class);
                        dataMap.computeIfAbsent(rec.getGroup(), k -> new HashMap<>())
                            .put(new TopicPartition(rec.getTopic(), rec.getPartition()), new OffsetAndMetadata(rec.getOffset()));
                    }
                }
            } catch (IOException e) {
                throw new RuntimeException(e);
            }

            return dataMap;
        }
Returns states of the specified consumer groups and partition assignment states
tools/src/main/java/org/apache/kafka/tools/consumer/group/ConsumerGroupCommand.java