[ 
https://issues.apache.org/jira/browse/CSV-239?focusedWorklogId=249048&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-249048
 ]

ASF GitHub Bot logged work on CSV-239:
--------------------------------------

                Author: ASF GitHub Bot
            Created on: 27/May/19 21:59
            Start Date: 27/May/19 21:59
    Worklog Time Spent: 10m 
      Work Description: coveralls commented on issue #42: [CSV-239] Add javadoc 
to CSVFormat
URL: https://github.com/apache/commons-csv/pull/42#issuecomment-496312069
 
 
   
   [![Coverage 
Status](https://coveralls.io/builds/23636021/badge)](https://coveralls.io/builds/23636021)
   
   Coverage remained the same at 90.807% when pulling 
**e177f5dc37e737b0fcc1649ab08ac3096a610e0d on davidmoten:add-javadoc** into 
**dca99998f17a9755dfb40ed30bc1734e54ba0b04 on apache:master**.
   
 
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 249048)
    Time Spent: 3h 10m  (was: 3h)

> Cannot get headers in column order from CSVRecord
> -------------------------------------------------
>
>                 Key: CSV-239
>                 URL: https://issues.apache.org/jira/browse/CSV-239
>             Project: Commons CSV
>          Issue Type: Improvement
>          Components: Parser
>    Affects Versions: 1.6
>            Reporter: Dave Moten
>            Priority: Minor
>             Fix For: 1.7
>
>          Time Spent: 3h 10m
>  Remaining Estimate: 0h
>
> I have a use case where I read many lines from an arbitrary csv file with a 
> given CSVFormat as List<CSVRecord>, transform that list and then want to 
> write the transformed list to another file. 
> When I specify the format as CSVFormat.DEFAULT.withFirstRecordAsHeader() the 
> headers from the first line are available in the CSVRecord object via the 
> CSVRecord.toMap object but their column positions are not (the iteration of 
> the returned map does not reflect column order). Consequently I cannot write 
> a header line in the correct order to the output csv file (which I do when 
> the first CSVRecord is to be written).
> Another option would be to be to ensure that the CSVPrinter object writes the 
> header on the first call to CSVPrinter.printRecord but we should also be able 
> to cover the user case where we are writing to a non-csv format and we still 
> want to write the headers in the correct order. 
> My preference at minimum is that the headers with column order are available 
> from CSVRecord (after all the data to supply this is already present in 
> CVSRecord). The addition of a method `getHeaders` returning a `List<String>` 
> would do the job. I'm happy to submit a PR if desired.
> I've marked this as of minor importance but I think it's a pretty important 
> flaw in the library at the moment that prevents event the simplest of 
> round-trip (read then write) scenarios when the headers are read from the 
> file rather than known up-front.



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

Reply via email to