コード例 #1
0
 @Test
 public void emptySketch() throws Exception {
   EvalFunc<Double> func = new GetQuantileFromDoublesSketch();
   DoublesSketch sketch = DoublesSketch.builder().build();
   Double result =
       func.exec(
           tupleFactory.newTuple(Arrays.asList(new DataByteArray(sketch.toByteArray()), 0.0)));
   Assert.assertEquals(result, Double.POSITIVE_INFINITY);
 }
コード例 #2
0
 @Test
 public void normalCase() throws Exception {
   EvalFunc<Double> func = new GetQuantileFromDoublesSketch();
   DoublesSketch sketch = DoublesSketch.builder().build();
   sketch.update(1.0);
   Double result =
       func.exec(
           tupleFactory.newTuple(Arrays.asList(new DataByteArray(sketch.toByteArray()), 0.5)));
   Assert.assertEquals(result, 1.0);
 }
コード例 #3
0
 @Test(expectedExceptions = IllegalArgumentException.class)
 public void wrongTypeForFraction() throws Exception {
   EvalFunc<Double> func = new GetQuantileFromDoublesSketch();
   DoublesSketch sketch = DoublesSketch.builder().build();
   func.exec(tupleFactory.newTuple(Arrays.asList(new DataByteArray(sketch.toByteArray()), 1)));
 }