Percentiles { @UserAggregationFunction("apoc.agg.percentiles") @Description("apoc.agg.percentiles(value,[percentiles = 0.5,0.75,0.9,0.95,0.99]) - returns given percentiles for values") public PercentilesFunction percentiles() { return new PercentilesFunction(); }  @UserAggregationFunction("apoc.agg.percentiles") @Description("apoc.agg.percentiles(value,[percentiles = 0.5,0.75,0.9,0.95,0.99]) - returns given percentiles for values") PercentilesFunction percentiles();  }
@Test public void testPercentiles() throws Exception { testCall(db, "UNWIND [] as value RETURN apoc.agg.percentiles(value) as p", (row) -> { assertEquals(asList(null,null,null,null,null,null), row.get("p")); }); testCall(db, "UNWIND [0,1,1,2,2,2,3] as value RETURN apoc.agg.percentiles(value,[0.5,0.95]) as p", (row) -> { assertEquals(asList(2L,3L), row.get("p")); }); testCall(db, "UNWIND [1,1,1,1,2,2,3,4] as value RETURN apoc.agg.percentiles(value) as p", (row) -> { assertEquals(asList(1L,2L,3L,4L,4L), row.get("p")); }); testCall(db, "UNWIND [1,1,1,1,2,2,3,4] as value RETURN apoc.agg.percentiles(value,[0.5,0.75,0.9,0.95,0.99]) as p", (row) -> { assertEquals(asList(1L,2L,3L,4L,4L), row.get("p")); }); }