commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Benedikt Ritter (JIRA)" <>
Subject [jira] [Commented] (CSV-112) HeaderMap inconsistent when duplicate columns names
Date Sun, 04 May 2014 15:51:14 GMT


Benedikt Ritter commented on CSV-112:

The problem is, that we provide a key based access to the values of a {{CSVRecord}} using
the {{get(String)}} method. How should that method behave if there are duplicate column names?

> HeaderMap inconsistent when duplicate columns names
> ---------------------------------------------------
>                 Key: CSV-112
>                 URL:
>             Project: Commons CSV
>          Issue Type: Bug
>          Components: Parser
>    Affects Versions: 1.0
>            Reporter: Romain Gossé
>              Labels: headers, parsing
> Given a parser format for csv files with a header line:
> {code}
> CSVFormat myFormat = CSVFormat.RFC4180.withDelimiter(",").withQuoteChar('"').withQuotePolicy(Quote.MINIMAL)
> 				.withIgnoreSurroundingSpaces(true).withHeader().withSkipHeaderRecord(true);
> {code}
> And given a file with duplicate header names:
> Col1,Col2,Col2,Col3,Col4
> 1,2,3,4,5
> 4,5,6,7,8 
> The HeaderMap returned by the parser misses an entry because of the Column name being
used as a key, leading to wrong behavior when we rely on it.
> If this is not supposed to happen in the file regarding the CSV format, at least this
should raise an error. If not we should come up with a more clever way to store and access
the headers.

This message was sent by Atlassian JIRA

View raw message