Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

generate_csv - generated CSV header is always alphabetically ordered #90

Closed
jqnatividad opened this issue Nov 13, 2021 · 10 comments
Closed
Assignees
Labels

Comments

@jqnatividad
Copy link
Collaborator

First off, thanks for this awesome library!

However, the generated csv's headers are alphabetically ordered.

The generated data itself is OK.

@dsietz
Copy link
Owner

dsietz commented Nov 13, 2021

@jqnatividad Thank you for submitting this bug. I'll take a look at it.

@dsietz
Copy link
Owner

dsietz commented Nov 13, 2021

Looks like the root cause is the the BTreeMap doesn't preserve the order of insertion.
https://github.com/dsietz/test-data-generation/blob/master/src/data_sample_parser.rs#L358

@jqnatividad
Copy link
Collaborator Author

As I understand it, BTreeMap sorts the keys.

Perhaps, use https://github.com/bluss/indexmap instead?

@dsietz
Copy link
Owner

dsietz commented Nov 13, 2021

It looks like that crate will work. Thanks for the suggestion. It will be a breaking change because any saved DataSampleParsers (DSP) from the prior version will not be able to be loaded from file into this new DataSampleParser struct.

@jqnatividad
Copy link
Collaborator Author

Time for test-data-generation 0.3 perhaps? 😉

I'm keen to use it to power test data generation for qsv.

dsietz added a commit that referenced this issue Nov 13, 2021
dsietz added a commit that referenced this issue Nov 14, 2021
dsietz added a commit that referenced this issue Nov 14, 2021
dsietz added a commit that referenced this issue Nov 14, 2021
dsietz added a commit that referenced this issue Nov 14, 2021
@dsietz dsietz added the bug label Nov 14, 2021
@dsietz dsietz self-assigned this Nov 14, 2021
@dsietz
Copy link
Owner

dsietz commented Nov 14, 2021

Fix in development and passing. Will be included in release 0.3.0

@dsietz
Copy link
Owner

dsietz commented Nov 14, 2021

version 0.3.0 has been published to crates.io

@dsietz dsietz closed this as completed Nov 14, 2021
@dsietz
Copy link
Owner

dsietz commented Nov 14, 2021

This issue is resolved.

@jqnatividad
Copy link
Collaborator Author

Hi @dsietz , just wanted to let you know that I just published qsv 0.22.0 with the generate command powered by test-data-generation.

Once again, thanks for this awesome library and I look forward to your feedback!

@dsietz
Copy link
Owner

dsietz commented Nov 16, 2021

@jqnatividad You're welcome. And much success with qsv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants