-
-
Notifications
You must be signed in to change notification settings - Fork 50
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
Add a flag to allow the user to specify that if excess columns are fo… #98
Add a flag to allow the user to specify that if excess columns are fo… #98
Conversation
…und in any given row, they can be ignored (e.g. row is truncated)
…ow us to change an Int? to an Int. Once the loop is entered we know that this variable is thread safe, but to avoid using !! assertions we can re-assign the value to a val. Other option is to write a peak function for the sequence to get a non-nullable initial value.
Hi, @kev3978. Thanks for your pull request! |
If you have a csv: A,B,C Then ignoreExcess cols will result in 3 lines being read: e.g. the "G" on line 2 will be ignored. and skipMissMatchedRow will result in 2 lines being read: |
Thank you for your detailed explanation, but the How about making the The new option can take four values.
|
I don't think this is correct, for example, if you change the test I made in CsvReaderTest to use "skipMissMatchedRow" flag instead of "ignoreExcess" then the test will fail, since it will ignore the second row rather than cutting it down. I do like your solution of packaging the behaviour into a single option, however I would suggest the following:
I don't think we can handle the situation with a csv like: If we try to do the "Ignore if short" behaviour, then we will need to place a null in the second row, to deal with the situation where we use |
I agree with you. 👍
If it's okay with you, I'd love to have your pull request modified. |
Hi @doyaaaaaken - absolutely, I will alter it later this week. |
…lengths * Deprecate, but do not remove, the [skipMissMatchedRow] property on the context
…t field lengths * Deprecate, but do not remove, the [skipMissMatchedRow] property on the context" This reverts commit e711b39
…MatchedRow * Update README
@doyaaaaaken I've just thought, there could be a case where the user wants both the TRIM_EXCESS and IGNORE options, e.g. they want to trim the excess columns if possible, or ignore the row if there are fewer than expected. With that in mind, I have reverted back to my original solution and updated the README to reflect that change. I've also added another test case. |
Thanks for the great point!
I would very much appreciate it, but I think we should follow a different way. My suggestion is we introduce new |
Sounds like a good solution, I will update the PR later this week. 👍 |
…excess/insufficient field behaviour. Retain existing behaviour for skipping mismatched rows generically and deprecate the property.
@doyaaaaaken - I've updated the PR with those changes now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! Thanks a lot!
Released on version 1.3.0 🚀 |
…und in any given row, they can be ignored (e.g. row is truncated)