Uploaded image for project: 'Commons CSV'
  1. Commons CSV
  2. CSV-236

Allow duplicate headers in CSV File

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Major
    • Resolution: Fixed
    • Discussion
    • 1.10.0
    • Parser
    • None

    Description

      Currently if a CSV file has a duplicate column header, a runtime exception is thrown:

      https://github.com/apache/commons-csv/blob/546fd69eaa6b3fd2c9da8b4222a3822f1ab53abd/src/main/java/org/apache/commons/csv/CSVParser.java#L492

      I think that may be a bit harsh reaction, as there could be some columns whose data is relative to its column order. I understand the header map uses the column name as the key, however I anticipate one could flip the map to be a Map<Integer, String> so its column number is the key.

      Anyway I am curious what the genesis of this decision was to use column headers as the key and if it's worthwhile to flip the map and allow for duplicate column names.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              esend7881 Eric K. Sender
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - 24h
                  24h
                  Remaining:
                  Remaining Estimate - 24h
                  24h
                  Logged:
                  Time Spent - Not Specified
                  Not Specified