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

Use Apache commons CSV package for both serializer and deserializer i… #613

Conversation

hjafarpour
Copy link
Contributor

…n delimited format.
Previously we only had Apache Commons CSV package in deserializer for delimited format. This PR uses the same package for both serializing and deserializing the delimited format.

@hjafarpour hjafarpour self-assigned this Jan 10, 2018
Copy link

@bluemonk3y bluemonk3y left a comment

Choose a reason for hiding this comment

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

lgtm

@@ -82,6 +80,9 @@ public GenericRow deserialize(final String topic, final byte[] bytes) {

private Object enforceFieldType(Schema fieldSchema, String delimitedField) {

if (delimitedField.length() == 0) {
Copy link
Contributor

@satybald satybald Jan 11, 2018

Choose a reason for hiding this comment

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

one minor suggestion string has isEmpty method, that has the same logic: value.length == 0.

@@ -92,11 +93,7 @@ private Object enforceFieldType(Schema fieldSchema, String delimitedField) {
case FLOAT64:
return Double.parseDouble(delimitedField);
case STRING:
if (delimitedField.startsWith("'") && delimitedField.endsWith("'")) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Why get rid of these checks?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No need anymore since the read and write is done with the same apache commons package and we currently support default config.

Copy link
Contributor

@dguy dguy left a comment

Choose a reason for hiding this comment

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

LGTM

@hjafarpour hjafarpour merged commit 1c4199b into confluentinc:master Jan 16, 2018
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.

5 participants