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

convert some string keywords to bool #13

Merged
merged 2 commits into from
Mar 13, 2017

Conversation

takumakanari
Copy link
Collaborator

This p-r adds new feature that converts some string keywords to boolean value.

embulk-json-path has similar feature, added at takumakanari/embulk-parser-json#1.

Copy link
Owner

@hiroyuki-sato hiroyuki-sato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, I forgot to push submit review button.
I think it is better to add some strings like the below for compatibility CSV parser plugin behavior.

How do you think?

private static final List<String> BOOL_TRUE_STRINGS = ImmutableList.of("true", "1", "yes","y","t","on");

@@ -25,6 +29,8 @@
implements ColumnVisitor
{
private static final JsonParser JSON_PARSER = new JsonParser();
private static final List<String> BOOL_TRUE_STRINGS = ImmutableList.of("true", "1", "yes");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The CSV parser treat the following value as true.
So I think it is better to add a some keywords (ex On) for true value.

How do you think?

ImmutableSet.of(
        "true", "True", "TRUE",
        "yes", "Yes", "YES",
        "t", "T", "y", "Y",
        "on", "On", "ON",
        "1");

https://github.com/embulk/embulk/blob/master/embulk-standards/src/main/java/org/embulk/standards/CsvParserPlugin.java#L36-L41

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

BTW: Is it better to follow CSVParserPlugin to convert string keywords to bool? What do you think about this?

@takumakanari
Copy link
Collaborator Author

@hiroyuki-sato Thanks for your review. As we discussed on Twitter, I added more words to convert to bool.
Could you check it again?

@hiroyuki-sato hiroyuki-sato merged commit 0496054 into hiroyuki-sato:master Mar 13, 2017
@hiroyuki-sato
Copy link
Owner

Thank you!
LGTM 👍
I've merged!
(We discussed this topic on twitter) (Japanese text)

@takumakanari
Copy link
Collaborator Author

Thank you!

@takumakanari takumakanari deleted the boolean-strings branch March 13, 2017 07:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants