Uploaded image for project: 'Apache NiFi'
  1. Apache NiFi
  2. NIFI-8377

CSVReader: quoting and trimming with value separator inconsistency

    XMLWordPrintableJSON

Details

    Description

      There is a little inconsistency of quoting and trimming when the value separator is present in the data and using Apache Common CSV parser.

      Example:

      case, A, B
      quoted value,"aa",
      quoted and trimmed value, "aa" ,
      quoted value with comma,"a,a",
      trimmed but wrongly unquoted value with comma, "a,a" ,

      here in the 3 first cases, the value is correctly parsed

      A : "aa", B : null
      A : "aa", B : null
      A : "a,a", B : null

      so using separately quoting containing the value separator or spaces to trim works well.
       
      However in the last example that combine quoted value separator and outer spaces to trim, then quoting fails

      A : "\"a", B : "a\""

       
      I think setting org.apache.commons.csv.CSVFormat.withIgnoreSurroundingSpaces(true) on the CSV parser would solve the issue, but I don't see the whole picture to tell if this would have other side effects.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              Kasonnara Kasonnara
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 1h 40m
                  1h 40m