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

JsonLine should handle empty lines #966

Merged
merged 3 commits into from
Aug 8, 2014
Merged

JsonLine should handle empty lines #966

merged 3 commits into from
Aug 8, 2014

Conversation

mariussoutier
Copy link
Contributor

Currently, JsonLine fails on empty / white lines. I think it'd be quite convenient to simply ignore them.

Currently it fails while parsing
val values = splitFields.map { nestedRetrieval(Option(fs), _) }
new cascading.tuple.Tuple(values: _*)
pipe.collectTo[String, Tuple]('line -> fields) {
case line: String if line.trim.nonEmpty =>
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm wondering if this should be configurable? Are there cases where you might simply want to fail in this case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good question, but by default it can be assumed that generating lines of JSON will at least generate some trailing lines which should not make it fail. If you wish I can add a constructor parameter.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So, should I modify it, or can it be merged the way it is?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you modify it and have the current behavior remain constant with what it is? It avoids this being a breaking change on users at run time.

…velop

Conflicts:
	scalding-json/src/main/scala/com/twitter/scalding/JsonLine.scala
	scalding-json/src/test/scala/com/twitter/scalding/JsonLineTest.scala
@mariussoutier
Copy link
Contributor Author

Well rebase didn't help avoid the merge conflicts, guess I'll have to redo it.

@johnynek
Copy link
Collaborator

johnynek commented Aug 8, 2014

Thanks for taking the time here to address our concerns.

johnynek added a commit that referenced this pull request Aug 8, 2014
JsonLine should handle empty lines
@johnynek johnynek merged commit 4d006b8 into twitter:develop Aug 8, 2014
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.

3 participants