GetCdfFromSketchUDF
diff --git a/src/main/java/com/yahoo/sketches/hive/kll/GetCdfFromSketchUDF.java b/src/main/java/com/yahoo/sketches/hive/kll/GetCdfFromSketchUDF.java
new file mode 100644
index 0000000..d846069
--- /dev/null
+++ b/src/main/java/com/yahoo/sketches/hive/kll/GetCdfFromSketchUDF.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright 2019, Verizon Media.
+ * Licensed under the terms of the Apache License 2.0. See LICENSE file at the project root for terms.
+ */
+
+package com.yahoo.sketches.hive.kll;
+
+import java.util.List;
+
+import org.apache.hadoop.hive.ql.exec.Description;
+import org.apache.hadoop.hive.ql.exec.UDF;
+import org.apache.hadoop.io.BytesWritable;
+
+import com.yahoo.memory.Memory;
+import com.yahoo.sketches.kll.KllFloatsSketch;
+
+@Description(
+  name = "GetCDF",
+  value = "_FUNC_(sketch, split points...)",
+  extended = "Returns an approximation to the Cumulative Distribution Function (CDF)"
+  + " from a sketch given a set of split points (values)."
+  + " Split points are an array of M unique, monotonically increasing values"
+  + " that divide the real number line into M+1 consecutive disjoint intervals."
+  + " The function returns an array of M+1 double valuess, the first M of which are approximations"
+  + " to the ranks of the corresponding split points (fraction of input stream values that are less"
+  + " than a split point). The last value is always 1."
+  + " CDF can also be viewed as a cumulative version of PMF.")
+public class GetCdfFromSketchUDF extends UDF {
+
+  /**
+   * Returns a list of ranks (CDF) from a given sketch
+   * @param serializedSketch serialized sketch
+   * @param splitPoints list of unique and monotonically increasing values
+   * @return list of fractions from 0 to 1
+   */
+  public List<Double> evaluate(final BytesWritable serializedSketch, final Float... splitPoints) {
+    if (serializedSketch == null) { return null; }
+    final KllFloatsSketch sketch = KllFloatsSketch.heapify(Memory.wrap(serializedSketch.getBytes()));
+    final double[] cdf = sketch.getCDF(Util.objectsToPrimitives(splitPoints));
+    if (cdf == null) { return null; }
+    return Util.primitivesToList(cdf);
+  }
+
+}
diff --git a/src/test/java/com/yahoo/sketches/hive/kll/GetCdfFromSketchUDFTest.java b/src/test/java/com/yahoo/sketches/hive/kll/GetCdfFromSketchUDFTest.java
new file mode 100644
index 0000000..5d125f6
--- /dev/null
+++ b/src/test/java/com/yahoo/sketches/hive/kll/GetCdfFromSketchUDFTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright 2019, Verizon Media.
+ * Licensed under the terms of the Apache License 2.0. See LICENSE file at the project root for terms.
+ */
+
+package com.yahoo.sketches.hive.kll;
+
+import java.util.List;
+
+import org.apache.hadoop.io.BytesWritable;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.yahoo.sketches.kll.KllFloatsSketch;
+
+public class GetCdfFromSketchUDFTest {
+
+  @Test
+  public void nullSketch() {
+    List<Double> result = new GetCdfFromSketchUDF().evaluate(null, 0f);
+    Assert.assertNull(result);
+  }
+
+  @Test
+  public void emptyListOfSplitPoints() {
+    KllFloatsSketch sketch = new KllFloatsSketch();
+    sketch.update(1);
+    sketch.update(2);
+    sketch.update(3);
+    List<Double> result = new GetCdfFromSketchUDF().evaluate(new BytesWritable(sketch.toByteArray()));
+    Assert.assertNotNull(result);
+    Assert.assertEquals(result.size(), 1);
+    Assert.assertEquals(result.get(0), 1.0);
+  }
+
+  @Test
+  public void emptySketch() {
+    KllFloatsSketch sketch = new KllFloatsSketch();
+    List<Double> result = new GetCdfFromSketchUDF().evaluate(new BytesWritable(sketch.toByteArray()), 0f);
+    Assert.assertNull(result);
+  }
+
+  @Test
+  public void normalCase() {
+    KllFloatsSketch sketch = new KllFloatsSketch();
+    sketch.update(1);
+    sketch.update(2);
+    sketch.update(3);
+    sketch.update(4);
+    List<Double> result = new GetCdfFromSketchUDF().evaluate(new BytesWritable(sketch.toByteArray()), 1f, 3f, 4f);
+    Assert.assertNotNull(result);
+    Assert.assertEquals(result.size(), 4);
+    Assert.assertEquals(result.get(0), 0.0);
+    Assert.assertEquals(result.get(1), 0.5);
+    Assert.assertEquals(result.get(2), 0.75);
+    Assert.assertEquals(result.get(3), 1.0);
+  }
+
+}