[CSV] New feature to allow access to leading/trailing comments in CSV files?
Dear all, I have an application where it would be useful to be able to get the leading comments (ie. before the first record) from a CSV file. I asked a question on StackOverflow[1] but I got no replies and as far as I can see it's not possible. I looked into implementing this myself and it appeared to be pretty straightforward, since the CSV parser already pulls out the comments but then discards them. It was also straightforward to access trailing comments too. I created a patch with the implementation and a test. Would there be any interest from the commons-csv developers in this patch? I appreciate there may be reasons I am not aware of as to why commons-csv doesn't do this already. Thanks, Peter [1]: https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv
Re: [CSV] New feature to allow access to leading/trailing comments in CSV files?
Hi Peter, I think not keeping comments may help with memory management in cases where you have an enormous amount of comments, or maybe speed up processing if you discard them? Not sure. But in any case, if you already have the patch working, I'd suggest 1) taking a look at the JIRA of CSV and searching for any open or closed issues similar to this one (I feel like I heard something similar before for Commons CSV), and then 2) creating an issue to the CSV component and 3) prepare the pull request using a commit message like "[CSV-1234etc] Description...", and the PR title "[CSV-1234] Title..." . This way others can review your code and comment there. And having the JIRA will help future users with similar use cases in case it's not maintained, or if there's some other feature they are missing. Thanks -Bruno On Tue, 6 Sept 2022 at 20:31, Peter Hull wrote: > Dear all, > I have an application where it would be useful to be able to get the > leading comments (ie. before the first record) from a CSV file. > I asked a question on StackOverflow[1] but I got no replies and as far as I > can see it's not possible. > I looked into implementing this myself and it appeared to be pretty > straightforward, since the CSV parser already pulls out the comments but > then discards them. It was also straightforward to access trailing comments > too. I created a patch with the implementation and a test. > Would there be any interest from the commons-csv developers in this patch? > I appreciate there may be reasons I am not aware of as to why commons-csv > doesn't do this already. > Thanks, > Peter > > [1]: > > https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv >
Re: [CSV] New feature to allow access to leading/trailing comments in CSV files?
Hi Bruno, Thanks for the swift reply! I have created CSV-304. I attached a patch to the ticket but I don't know how to submit a pull request, please could you advise? Peter On Tue, 6 Sept 2022 at 11:37, Bruno Kinoshita wrote: > Hi Peter, > > I think not keeping comments may help with memory management in cases where > you have an enormous amount of comments, or maybe speed up processing if > you discard them? Not sure. > > But in any case, if you already have the patch working, I'd suggest 1) > taking a look at the JIRA of CSV and searching for any open or closed > issues similar to this one (I feel like I heard something similar before > for Commons CSV), and then 2) creating an issue to the CSV component and 3) > prepare the pull request using a commit message like "[CSV-1234etc] > Description...", and the PR title "[CSV-1234] Title..." . This way others > can review your code and comment there. And having the JIRA will help > future users with similar use cases in case it's not maintained, or if > there's some other feature they are missing. > > Thanks > -Bruno > > On Tue, 6 Sept 2022 at 20:31, Peter Hull wrote: > > > Dear all, > > I have an application where it would be useful to be able to get the > > leading comments (ie. before the first record) from a CSV file. > > I asked a question on StackOverflow[1] but I got no replies and as far > as I > > can see it's not possible. > > I looked into implementing this myself and it appeared to be pretty > > straightforward, since the CSV parser already pulls out the comments but > > then discards them. It was also straightforward to access trailing > comments > > too. I created a patch with the implementation and a test. > > Would there be any interest from the commons-csv developers in this > patch? > > I appreciate there may be reasons I am not aware of as to why commons-csv > > doesn't do this already. > > Thanks, > > Peter > > > > [1]: > > > > > https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv > > >
Re: [CSV] New feature to allow access to leading/trailing comments in CSV files?
Please see https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request Gary On Tue, Sep 6, 2022, 06:05 Peter Hull wrote: > Hi Bruno, > Thanks for the swift reply! I have created CSV-304. I attached a patch to > the ticket but I don't know how to submit a pull request, please could you > advise? > Peter > > On Tue, 6 Sept 2022 at 11:37, Bruno Kinoshita wrote: > > > Hi Peter, > > > > I think not keeping comments may help with memory management in cases > where > > you have an enormous amount of comments, or maybe speed up processing if > > you discard them? Not sure. > > > > But in any case, if you already have the patch working, I'd suggest 1) > > taking a look at the JIRA of CSV and searching for any open or closed > > issues similar to this one (I feel like I heard something similar before > > for Commons CSV), and then 2) creating an issue to the CSV component and > 3) > > prepare the pull request using a commit message like "[CSV-1234etc] > > Description...", and the PR title "[CSV-1234] Title..." . This way others > > can review your code and comment there. And having the JIRA will help > > future users with similar use cases in case it's not maintained, or if > > there's some other feature they are missing. > > > > Thanks > > -Bruno > > > > On Tue, 6 Sept 2022 at 20:31, Peter Hull wrote: > > > > > Dear all, > > > I have an application where it would be useful to be able to get the > > > leading comments (ie. before the first record) from a CSV file. > > > I asked a question on StackOverflow[1] but I got no replies and as far > > as I > > > can see it's not possible. > > > I looked into implementing this myself and it appeared to be pretty > > > straightforward, since the CSV parser already pulls out the comments > but > > > then discards them. It was also straightforward to access trailing > > comments > > > too. I created a patch with the implementation and a test. > > > Would there be any interest from the commons-csv developers in this > > patch? > > > I appreciate there may be reasons I am not aware of as to why > commons-csv > > > doesn't do this already. > > > Thanks, > > > Peter > > > > > > [1]: > > > > > > > > > https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv > > > > > >
Re: [CSV] New feature to allow access to leading/trailing comments in CSV files?
Hi Gary, Thanks for that, I've done it now. I didn't really mean to ask "how" to submit a pull request, more "where" to submit it, as the Apache page just mentions a repo at gitbox.apache.org and the Contributing page describes attaching a patch file derived from SVN. I assumed the github repo was just mirrored for convenience. Peter On Tue, 6 Sept 2022 at 15:23, Gary Gregory wrote: > Please see > > https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request > > Gary > > On Tue, Sep 6, 2022, 06:05 Peter Hull wrote: > > > Hi Bruno, > > Thanks for the swift reply! I have created CSV-304. I attached a patch to > > the ticket but I don't know how to submit a pull request, please could > you > > advise? > > Peter > > > > On Tue, 6 Sept 2022 at 11:37, Bruno Kinoshita wrote: > > > > > Hi Peter, > > > > > > I think not keeping comments may help with memory management in cases > > where > > > you have an enormous amount of comments, or maybe speed up processing > if > > > you discard them? Not sure. > > > > > > But in any case, if you already have the patch working, I'd suggest 1) > > > taking a look at the JIRA of CSV and searching for any open or closed > > > issues similar to this one (I feel like I heard something similar > before > > > for Commons CSV), and then 2) creating an issue to the CSV component > and > > 3) > > > prepare the pull request using a commit message like "[CSV-1234etc] > > > Description...", and the PR title "[CSV-1234] Title..." . This way > others > > > can review your code and comment there. And having the JIRA will help > > > future users with similar use cases in case it's not maintained, or if > > > there's some other feature they are missing. > > > > > > Thanks > > > -Bruno > > > > > > On Tue, 6 Sept 2022 at 20:31, Peter Hull > wrote: > > > > > > > Dear all, > > > > I have an application where it would be useful to be able to get the > > > > leading comments (ie. before the first record) from a CSV file. > > > > I asked a question on StackOverflow[1] but I got no replies and as > far > > > as I > > > > can see it's not possible. > > > > I looked into implementing this myself and it appeared to be pretty > > > > straightforward, since the CSV parser already pulls out the comments > > but > > > > then discards them. It was also straightforward to access trailing > > > comments > > > > too. I created a patch with the implementation and a test. > > > > Would there be any interest from the commons-csv developers in this > > > patch? > > > > I appreciate there may be reasons I am not aware of as to why > > commons-csv > > > > doesn't do this already. > > > > Thanks, > > > > Peter > > > > > > > > [1]: > > > > > > > > > > > > > > https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv > > > > > > > > > >
Re: [CSV] New feature to allow access to leading/trailing comments in CSV files?
Hi Peter, Yes, the GitHub repos are all mirrors, and the most convenient way to collaborate IMO, say, compared to our "plain" gitbox. Gary On Tue, Sep 6, 2022, 07:37 Peter Hull wrote: > Hi Gary, > Thanks for that, I've done it now. I didn't really mean to ask "how" to > submit a pull request, more "where" to submit it, as the Apache page just > mentions a repo at gitbox.apache.org and the Contributing page describes > attaching a patch file derived from SVN. I assumed the github repo was just > mirrored for convenience. > Peter > > On Tue, 6 Sept 2022 at 15:23, Gary Gregory wrote: > > > Please see > > > > > https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request > > > > Gary > > > > On Tue, Sep 6, 2022, 06:05 Peter Hull wrote: > > > > > Hi Bruno, > > > Thanks for the swift reply! I have created CSV-304. I attached a patch > to > > > the ticket but I don't know how to submit a pull request, please could > > you > > > advise? > > > Peter > > > > > > On Tue, 6 Sept 2022 at 11:37, Bruno Kinoshita > wrote: > > > > > > > Hi Peter, > > > > > > > > I think not keeping comments may help with memory management in cases > > > where > > > > you have an enormous amount of comments, or maybe speed up processing > > if > > > > you discard them? Not sure. > > > > > > > > But in any case, if you already have the patch working, I'd suggest > 1) > > > > taking a look at the JIRA of CSV and searching for any open or closed > > > > issues similar to this one (I feel like I heard something similar > > before > > > > for Commons CSV), and then 2) creating an issue to the CSV component > > and > > > 3) > > > > prepare the pull request using a commit message like "[CSV-1234etc] > > > > Description...", and the PR title "[CSV-1234] Title..." . This way > > others > > > > can review your code and comment there. And having the JIRA will help > > > > future users with similar use cases in case it's not maintained, or > if > > > > there's some other feature they are missing. > > > > > > > > Thanks > > > > -Bruno > > > > > > > > On Tue, 6 Sept 2022 at 20:31, Peter Hull > > wrote: > > > > > > > > > Dear all, > > > > > I have an application where it would be useful to be able to get > the > > > > > leading comments (ie. before the first record) from a CSV file. > > > > > I asked a question on StackOverflow[1] but I got no replies and as > > far > > > > as I > > > > > can see it's not possible. > > > > > I looked into implementing this myself and it appeared to be pretty > > > > > straightforward, since the CSV parser already pulls out the > comments > > > but > > > > > then discards them. It was also straightforward to access trailing > > > > comments > > > > > too. I created a patch with the implementation and a test. > > > > > Would there be any interest from the commons-csv developers in this > > > > patch? > > > > > I appreciate there may be reasons I am not aware of as to why > > > commons-csv > > > > > doesn't do this already. > > > > > Thanks, > > > > > Peter > > > > > > > > > > [1]: > > > > > > > > > > > > > > > > > > > > https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv > > > > > > > > > > > > > > >
Re: [CSV] New feature to allow access to leading/trailing comments in CSV files?
Hello. Le mar. 6 sept. 2022 à 16:37, Peter Hull a écrit : > > Hi Gary, > Thanks for that, I've done it now. I didn't really mean to ask "how" to > submit a pull request, more "where" to submit it, as the Apache page just > mentions a repo at gitbox.apache.org and the Contributing page describes > attaching a patch file derived from SVN. I assumed the github repo was just > mirrored for convenience. The GitHub "mirror" (GH) works better (unfortunately, IMHO) than the "original" repositories hosted at ASF[1]; so you can just create PR on GH... About your patch: It is preferable to have a separate test method for each test case. If there is no better description, it is fine to append a "counter" to the "common" test name. i.e. @Test public void getHeaderComment1() { /* ... */ } @Test public void getHeaderComment2() { /* ... */ } ... and so on ... Thanks, Gilles [1] https://gitbox.apache.org/repos/asf?p=commons-csv.git > Peter > > On Tue, 6 Sept 2022 at 15:23, Gary Gregory wrote: > > > Please see > > > > https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/proposing-changes-to-your-work-with-pull-requests/creating-a-pull-request > > > > Gary > > > > On Tue, Sep 6, 2022, 06:05 Peter Hull wrote: > > > > > Hi Bruno, > > > Thanks for the swift reply! I have created CSV-304. I attached a patch to > > > the ticket but I don't know how to submit a pull request, please could > > you > > > advise? > > > Peter > > > > > > On Tue, 6 Sept 2022 at 11:37, Bruno Kinoshita wrote: > > > > > > > Hi Peter, > > > > > > > > I think not keeping comments may help with memory management in cases > > > where > > > > you have an enormous amount of comments, or maybe speed up processing > > if > > > > you discard them? Not sure. > > > > > > > > But in any case, if you already have the patch working, I'd suggest 1) > > > > taking a look at the JIRA of CSV and searching for any open or closed > > > > issues similar to this one (I feel like I heard something similar > > before > > > > for Commons CSV), and then 2) creating an issue to the CSV component > > and > > > 3) > > > > prepare the pull request using a commit message like "[CSV-1234etc] > > > > Description...", and the PR title "[CSV-1234] Title..." . This way > > others > > > > can review your code and comment there. And having the JIRA will help > > > > future users with similar use cases in case it's not maintained, or if > > > > there's some other feature they are missing. > > > > > > > > Thanks > > > > -Bruno > > > > > > > > On Tue, 6 Sept 2022 at 20:31, Peter Hull > > wrote: > > > > > > > > > Dear all, > > > > > I have an application where it would be useful to be able to get the > > > > > leading comments (ie. before the first record) from a CSV file. > > > > > I asked a question on StackOverflow[1] but I got no replies and as > > far > > > > as I > > > > > can see it's not possible. > > > > > I looked into implementing this myself and it appeared to be pretty > > > > > straightforward, since the CSV parser already pulls out the comments > > > but > > > > > then discards them. It was also straightforward to access trailing > > > > comments > > > > > too. I created a patch with the implementation and a test. > > > > > Would there be any interest from the commons-csv developers in this > > > > patch? > > > > > I appreciate there may be reasons I am not aware of as to why > > > commons-csv > > > > > doesn't do this already. > > > > > Thanks, > > > > > Peter > > > > > > > > > > [1]: > > > > > > > > > > > > > > > > > > > https://stackoverflow.com/questions/72619095/get-leading-comments-from-csv-with-apache-commons-csv > > > > > > > > > > > > > > - To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org For additional commands, e-mail: dev-h...@commons.apache.org
Re: [CSV] New feature to allow access to leading/trailing comments in CSV files?
On Tue, 6 Sept 2022 at 15:56, Gilles Sadowski wrote: > > About your patch: It is preferable to have a separate test method for > each test case. If there is no better description, it is fine to append > a "counter" to the "common" test name. i.e. > > Hi Gilles, I have done this, partly, and there are 14 test methods. I still have two tests in each method, one for hasXXX() and one for getXXX(). It seems a bit excessive already. In your judgement, should I cut some of them out? https://github.com/apache/commons-csv/pull/257/commits/0414d1e4b79a4f42d24c8b9a7547a8cbf4a40cf0 Peter