@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 testEscapeCharacterInCSV()
      throws Exception {
    // Create CSV config with backslash as escape character.
    CSVRecordReaderConfig csvRecordReaderConfig = new CSVRecordReaderConfig();
    csvRecordReaderConfig.setEscapeCharacter('\\');

    // Create a CSV file where records have two values and the second value contains an escaped comma.
    File escapedFile = new File(_tempDir, "escape.csv");
    BufferedWriter writer = new BufferedWriter(new FileWriter(escapedFile));
    writer.write("first,second\n");
    writer.write("string1, string2\\, string3");
    writer.close();

    // Try to parse CSV file with escaped comma.
    CSVRecordReader csvRecordReader = new CSVRecordReader();
    HashSet<String> fieldsToRead = new HashSet<>();
    fieldsToRead.add("first");
    fieldsToRead.add("second");
    csvRecordReader.init(escapedFile, fieldsToRead, csvRecordReaderConfig);
    GenericRow genericRow = new GenericRow();
    csvRecordReader.rewind();

    // check if parsing succeeded.
    Assert.assertTrue(csvRecordReader.hasNext());
    csvRecordReader.next(genericRow);
    Assert.assertEquals(genericRow.getValue("first"), "string1");
    Assert.assertEquals(genericRow.getValue("second"), "string2, string3");
  }