[ 
https://issues.apache.org/jira/browse/NIFI-5310?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16512478#comment-16512478
 ] 

Otto Fowler commented on NIFI-5310:
-----------------------------------

{code:java}
@Test
public void testSimpleParseWithSlashes() throws IOException, 
MalformedRecordException {
    final List<RecordField> fields = getDefaultFields();
    fields.replaceAll(f -> f.getFieldName().equals("balance") ? new 
RecordField("balance", doubleDataType) : f);

    final RecordSchema schema = new SimpleRecordSchema(fields);

    try (final InputStream fis = new FileInputStream(new 
File("src/test/resources/csv/with_slashes.csv"));
         final CSVRecordReader reader = createReader(fis, schema, format)) {

        final Object[] record = reader.nextRecord().getValues();
        final Object[] expectedValues = new Object[] {"1", "John Doe\\", 
4750.89D, "123 My Street", "My City", "MS", "11111", "USA"};
        Assert.assertArrayEquals(expectedValues, record);

        assertNull(reader.nextRecord());
    }
}
{code}
Also works

> Not able to read record as string type ending with \ (backslash)
> ----------------------------------------------------------------
>
>                 Key: NIFI-5310
>                 URL: https://issues.apache.org/jira/browse/NIFI-5310
>             Project: Apache NiFi
>          Issue Type: Bug
>          Components: Core Framework
>    Affects Versions: 1.6.0
>         Environment: Windows/Linux Both
>            Reporter: Nishant Gupta
>            Priority: Critical
>              Labels: BackSlash, CSV, Nifi, QueryRecord,
>         Attachments: IssueWithBackSlash.PNG
>
>
> *Processor* - QueryRecord 
> *RecordReader* - CSVReader
> *RecordWriter* - CSVRecordSetWriter
> *Data* Type- String
> {
> "name": "Name",
> "type": ["string","null"]
> }
> *Data - John\ (Failing), John\M(passing)*
> *Query* - select Name, ID from FLOWFILE



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to