@Override
  public void init(Set<String> fields, RecordExtractorConfig recordExtractorConfig) {
    CSVRecordExtractorConfig csvRecordExtractorConfig = (CSVRecordExtractorConfig) recordExtractorConfig;
    if (fields == null || fields.isEmpty()) {
      _fields = csvRecordExtractorConfig.getColumnNames();
    } else {
      _fields = ImmutableSet.copyOf(fields);
    }
    _multiValueDelimiter = csvRecordExtractorConfig.getMultiValueDelimiter();
  }
@Test
  public void testIgnoringSurroundingSpaces() throws IOException {
    CSVRecordReaderConfig csvRecordReaderConfig = new CSVRecordReaderConfig();

    // Create a CSV file where records have two values and the second value contains an extra space.
    File spaceFile = new File(_tempDir, "space.csv");
    BufferedWriter writer = new BufferedWriter(new FileWriter(spaceFile));
    writer.write("col1 ,col2\n");
    writer.write("\"value11\",\" value12\"");
    writer.close();

    CSVRecordReader csvRecordReader = new CSVRecordReader();
    HashSet<String> fieldsToRead = new HashSet<>();
    fieldsToRead.add("col1");
    fieldsToRead.add("col2");
    csvRecordReader.init(spaceFile, fieldsToRead, csvRecordReaderConfig);
    GenericRow genericRow = new GenericRow();
    csvRecordReader.rewind();

    // check if parsing succeeded.
    Assert.assertTrue(csvRecordReader.hasNext());
    csvRecordReader.next(genericRow);
    Assert.assertEquals(genericRow.getValue("col1"), "value11");
    Assert.assertEquals(genericRow.getValue("col2"), " value12");
  }