-
Notifications
You must be signed in to change notification settings - Fork 3.3k
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
HBASE-29040 Fix description of "sampleRate" of PerformanceEvaluation #6558
base: master
Are you sure you want to change the base?
Conversation
@@ -1205,7 +1205,7 @@ private static long nextRandomSeed() { | |||
this.opts = options; | |||
this.status = status; | |||
this.testName = this.getClass().getSimpleName(); | |||
everyN = (int) (opts.totalRows / (opts.totalRows * opts.sampleRate)); | |||
everyN = (int) (1 / opts.sampleRate); |
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.
This is unrelated to the problem described, but I thought why not.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
🎊 +1 overall
This message was automatically generated. |
🎊 +1 overall
This message was automatically generated. |
@@ -1205,7 +1205,7 @@ private static long nextRandomSeed() { | |||
this.opts = options; | |||
this.status = status; | |||
this.testName = this.getClass().getSimpleName(); | |||
everyN = (long) (opts.totalRows / (opts.totalRows * opts.sampleRate)); | |||
everyN = (long) (1 / opts.sampleRate); |
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.
I'm not sure whether (long) (1 / 1.0) will give us the correct result? Could it be 0?
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.
AFAIK, we don't have to worry about it because 1.0 (1 / 20) has a finite binary representation (unlike numbers like 0.1 or 0.2), so (1 / 1.0)
will not yield any arithmetic error.
irb(main):001> [0].pack('G').bytes.map { "%08b" % it }.join
=> "0000000000000000000000000000000000000000000000000000000000000000"
irb(main):002> [1].pack('G').bytes.map { "%08b" % it }.join
=> "0011111111110000000000000000000000000000000000000000000000000000"
irb(main):003> [0.1].pack('G').bytes.map { "%08b" % it }.join
=> "0011111110111001100110011001100110011001100110011001100110011010"
irb(main):004> [0.2].pack('G').bytes.map { "%08b" % it }.join
=> "0011111111001001100110011001100110011001100110011001100110011010"
https://en.wikipedia.org/wiki/Double-precision_floating-point_format#Double-precision_examples
The option applies to all tests since HBASE-10788.