MINOR: change initial value of Min stat to Double.MAX_VALUE (not MIN)#1143
MINOR: change initial value of Min stat to Double.MAX_VALUE (not MIN)#1143zackdever wants to merge 2 commits into
Conversation
|
Seems correct. I think the default value is used to create samples. In this case, the Min function would have reported an incorrect value right? Can you write a test case to prove correctness now? |
|
Yes I think it would have. I'll see if there's a relevant max test to keep things similar, or if not I'll write one for both. |
|
I updated |
|
+1 ! |
There was a problem hiding this comment.
nit: i'd prefer a new testcase. this doesn't really have anything to do with 'testOldDataHasNoEffect'
|
+1. minor |
f308727 to
67b052d
Compare
|
@auradkar I updated the test, let me know what you think. I think the Jenkins failures are unrelated. |
this is consistent with the Max stat implementation. also update variable names to `min` instead of `max`, and test.
instead of repurposing testOldDataHasNoEffect
|
Jenkins failures were unrelated - rebased master and all is passing now. |
|
|
||
| public Min() { | ||
| super(Double.MIN_VALUE); | ||
| super(Double.MAX_VALUE); |
There was a problem hiding this comment.
Nice catch (and sorry for long delay in review).
I saw we are using NEGATIVE_INFINITY for Max() default. Any reason not to use INFINITY here? It seems more consistent.
There was a problem hiding this comment.
No worries. I noticed that too, and I think it would be more consistent to use INFINITY, but the convention seems to be that the combine implementation uses the same value for the de facto default (even though it doesn't make use of initialValue). Min() is already using Double.MAX_VALUE in combine, so also changing that felt like a bigger change (and possibly unwelcome if users were already handling Double.MAX_VALUE in their metrics tooling).
this is consistent with the Max stat implementation. Author: Zack Dever <zdever@pandora.com> Reviewers: Aditya Auradkar, Gwen Shapira Closes apache#1143 from zackdever/min-stat-fix
this is consistent with the Max stat implementation.