You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gary Gregory (Jira)" <ji...@apache.org> on 2019/09/04 14:00:01 UTC

[jira] [Commented] (CSV-236) Allow duplicate headers in CSV File

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

Gary Gregory commented on CSV-236:
----------------------------------

[~esend7881],

I added the test `org.apache.commons.csv.CSVFormatTest.testJiraCsv236()` which passes in git master. May you please try 1.8-SNAPSHOT and report your results here?

Thank you,
Gary

> Allow duplicate headers in CSV File
> -----------------------------------
>
>                 Key: CSV-236
>                 URL: https://issues.apache.org/jira/browse/CSV-236
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Parser
>    Affects Versions: Discussion
>            Reporter: Eric K. Sender
>            Priority: Major
>   Original Estimate: 24h
>  Remaining Estimate: 24h
>
> 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.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)