NicoK commented on issue #8884: [FLINK-12981][metrics] ignore NaNs in 
percentile implementation
URL: https://github.com/apache/flink/pull/8884#issuecomment-521715481
 
 
   You get reduced overhead during percentile calculation, see this code from 
`Percentile#getWorkArray`:
   ```
       protected double[] getWorkArray(final double[] values, final int begin, 
final int length) {
               final double[] work;
               if (values == getDataRef()) {
                   work = getDataRef();
               } else {
                   switch (nanStrategy) {
                   case MAXIMAL:// Replace NaNs with +INFs
                       work = replaceAndSlice(values, begin, length, 
Double.NaN, Double.POSITIVE_INFINITY);
                       break;
                   case MINIMAL:// Replace NaNs with -INFs
                       work = replaceAndSlice(values, begin, length, 
Double.NaN, Double.NEGATIVE_INFINITY);
                       break;
                   case REMOVED:// Drop NaNs from data
                       work = removeAndSlice(values, begin, length, Double.NaN);
                       break;
                   case FAILED:// just throw exception as NaN is un-acceptable
                       work = copyOf(values, begin, length);
                       MathArrays.checkNotNaN(work);
                       break;
                   default: //FIXED
                       work = copyOf(values,begin,length);
                       break;
                   }
               }
               return work;
       }
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to