diff --git a/src/main/java/com/yahoo/sketches/quantiles/QuantilesSketchBuilder.java b/src/main/java/com/yahoo/sketches/quantiles/QuantilesSketchBuilder.java
index f0190d84d..4b80217a4 100644
--- a/src/main/java/com/yahoo/sketches/quantiles/QuantilesSketchBuilder.java
+++ b/src/main/java/com/yahoo/sketches/quantiles/QuantilesSketchBuilder.java
@@ -37,10 +37,11 @@ public QuantilesSketchBuilder() {
/**
* Sets the parameter k that determines the accuracy and size of the sketch
- * @param k determines the accuracy and size of the sketch. k must be greater than 0 and
- * less than 65536.
+ * @param k determines the accuracy and size of the sketch.
+ * k must be greater than 0 and less than 65536.
* It is recommended that k be a power of 2 to enable merging of sketches with
- * different values of k.
+ * different values of k. However, in this case it is only possible to merge from
+ * larger values of k to smaller values.
* @return this builder
*/
public QuantilesSketchBuilder setK(int k) {
@@ -115,7 +116,11 @@ public QuantilesSketch build() {
* Returns a QuantilesSketch with the current configuration of this Builder and the
* given parameter k.
* @param k determines the accuracy and size of the sketch.
- * Must be greater than 0 and less than 65536.
+ * k must be greater than 0 and less than 65536.
+ * It is recommended that k be a power of 2 to enable merging of sketches with
+ * different values of k. However, in this case it is only possible to merge from
+ * larger values of k to smaller values.
+ *
* @return a QuantilesSketch
*/
public QuantilesSketch build(int k) {
diff --git a/src/test/java/com/yahoo/sketches/quantiles/HeapQuantilesSketchTest.java b/src/test/java/com/yahoo/sketches/quantiles/HeapQuantilesSketchTest.java
index 1afcf6c81..7de5836aa 100644
--- a/src/test/java/com/yahoo/sketches/quantiles/HeapQuantilesSketchTest.java
+++ b/src/test/java/com/yahoo/sketches/quantiles/HeapQuantilesSketchTest.java
@@ -702,6 +702,14 @@ public void checkGetSeed() {
assertEquals(qs1.getSeed(), 0);
}
+ @Test(expectedExceptions = IllegalArgumentException.class)
+ public void checkImproperBuild() {
+ Memory mem = new NativeMemory(new byte[1024]);
+ @SuppressWarnings("unused")
+ QuantilesSketch qs1 = QuantilesSketch.builder().initMemory(mem).build(4);
+
+ }
+
@Test
public void checkKisOne() {
QuantilesSketch qs1 = QuantilesSketch.builder().build(1);