Skip to content

Fix incorrect usage of `percent'.#1455

Merged
johnynek merged 2 commits intotwitter:developfrom
vikasgorur:develop
Nov 22, 2015
Merged

Fix incorrect usage of `percent'.#1455
johnynek merged 2 commits intotwitter:developfrom
vikasgorur:develop

Conversation

@vikasgorur
Copy link
Contributor

Rename the argument to various sampling methods in TypedPipe and RichPipe
to 'fraction' instead of 'percent' as they accept values in the range [0, 1]
and not [1, 100].

Fixes #1448

Rename the argument to various sampling methods in TypedPipe and RichPipe
to `fraction' instead of `percent' as they accept values in the range [0, 1]
and not [1, 100].
@vikasgorur
Copy link
Contributor Author

Would it be appropriate for these methods to throw an IllegalArgumentException if the fraction is not in the range [0, 1]?

Motivation: I ran a job input.sample(10).save(output) intending to copy a fraction of the data but didn't realize my mistake until the job finished running. An early failure might be helpful in such cases.

@johnynek
Copy link
Collaborator

Thanks. Yes please add:

require(0.0 <= fraction && fraction <=1.0, s"got $fraction which is an invalid fraction")

johnynek added a commit that referenced this pull request Nov 22, 2015
Fix incorrect usage of `percent'.
@johnynek johnynek merged commit e629551 into twitter:develop Nov 22, 2015
@johnynek
Copy link
Collaborator

Thank you!

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