Source:
<code>public void init(File dataFile, @Nullable Set<String> fieldsToRead, @Nullable RecordReaderConfig recordReaderConfig) throws IOException { _dataFile = dataFile; CSVRecordReaderConfig config = (CSVRecordReaderConfig) recordReaderConfig; char multiValueDelimiter; if (config == null) { _format = CSVFormat.DEFAULT.withDelimiter(CSVRecordReaderConfig.DEFAULT_DELIMITER).withHeader(); multiValueDelimiter = CSVRecordReaderConfig.DEFAULT_MULTI_VALUE_DELIMITER; } else { CSVFormat format; String formatString = config.getFileFormat(); if (formatString == null) { format = CSVFormat.DEFAULT; } else { switch (formatString.toUpperCase()) { case "EXCEL": format = CSVFormat.EXCEL; break; case "MYSQL": format = CSVFormat.MYSQL; break; case "RFC4180": format = CSVFormat.RFC4180; break; case "TDF": format = CSVFormat.TDF; break; default: format = CSVFormat.DEFAULT; break; } } char delimiter = config.getDelimiter(); format = format.withDelimiter(delimiter); String csvHeader = config.getHeader(); if (csvHeader == null) { format = format.withHeader(); } else { format = format.withHeader(StringUtils.split(csvHeader, delimiter)); } Character commentMarker = config.getCommentMarker(); format = format.withCommentMarker(commentMarker); _format = format; multiValueDelimiter = config.getMultiValueDelimiter(); } _recordExtractor = new CSVRecordExtractor(); CSVRecordExtractorConfig recordExtractorConfig = new CSVRecordExtractorConfig(); recordExtractorConfig.setMultiValueDelimiter(multiValueDelimiter); init(); <START> if (fieldsToRead == null || fieldsToRead.isEmpty()) { <END> fieldsToRead = _parser.getHeaderMap().keySet(); } _recordExtractor.init(fieldsToRead, recordExtractorConfig); }</code><technical_language>i in CSV case fieldsToRead is null, get fields read in RecordReader. Versus, in JSON/AVRO case decision RecordExtractor. Is consistent RecordExtractor this decision</technical_language>

Target:
public void init(File dataFile, @Nullable Set<String> fieldsToRead, @Nullable RecordReaderConfig recordReaderConfig) throws IOException { _dataFile = dataFile; CSVRecordReaderConfig config = (CSVRecordReaderConfig) recordReaderConfig; char multiValueDelimiter; if (config == null) { _format = CSVFormat.DEFAULT.withDelimiter(CSVRecordReaderConfig.DEFAULT_DELIMITER).withHeader(); multiValueDelimiter = CSVRecordReaderConfig.DEFAULT_MULTI_VALUE_DELIMITER; } else { CSVFormat format; String formatString = config.getFileFormat(); if (formatString == null) { format = CSVFormat.DEFAULT; } else { switch (formatString.toUpperCase()) { case "EXCEL": format = CSVFormat.EXCEL; break; case "MYSQL": format = CSVFormat.MYSQL; break; case "RFC4180": format = CSVFormat.RFC4180; break; case "TDF": format = CSVFormat.TDF; break; default: format = CSVFormat.DEFAULT; break; } } char delimiter = config.getDelimiter(); format = format.withDelimiter(delimiter); String csvHeader = config.getHeader(); if (csvHeader == null) { format = format.withHeader(); } else { format = format.withHeader(StringUtils.split(csvHeader, delimiter)); } Character commentMarker = config.getCommentMarker(); format = format.withCommentMarker(commentMarker); _format = format; multiValueDelimiter = config.getMultiValueDelimiter(); } _recordExtractor = new CSVRecordExtractor(); init(); CSVRecordExtractorConfig recordExtractorConfig = new CSVRecordExtractorConfig(); recordExtractorConfig.setMultiValueDelimiter(multiValueDelimiter); recordExtractorConfig.setColumnNames(_parser.getHeaderMap().keySet()); _recordExtractor.init(fieldsToRead, recordExtractorConfig); }