Skip to content

Commit 792486a

Browse files
author
Lee Rhodes
committed
Update javadocs
1 parent a900b7c commit 792486a

2 files changed

Lines changed: 17 additions & 4 deletions

File tree

src/main/java/com/yahoo/sketches/quantiles/QuantilesSketchBuilder.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,11 @@ public QuantilesSketchBuilder() {
3737

3838
/**
3939
* Sets the parameter <i>k</i> that determines the accuracy and size of the sketch
40-
* @param k determines the accuracy and size of the sketch. <i>k</i> must be greater than 0 and
41-
* less than 65536.
40+
* @param k determines the accuracy and size of the sketch.
41+
* <i>k</i> must be greater than 0 and less than 65536.
4242
* It is recommended that <i>k</i> be a power of 2 to enable merging of sketches with
43-
* different values of <i>k</i>.
43+
* different values of <i>k</i>. However, in this case it is only possible to merge from
44+
* larger values of <i>k</i> to smaller values.
4445
* @return this builder
4546
*/
4647
public QuantilesSketchBuilder setK(int k) {
@@ -115,7 +116,11 @@ public QuantilesSketch build() {
115116
* Returns a QuantilesSketch with the current configuration of this Builder and the
116117
* given parameter <i>k</i>.
117118
* @param k determines the accuracy and size of the sketch.
118-
* Must be greater than 0 and less than 65536.
119+
* <i>k</i> must be greater than 0 and less than 65536.
120+
* It is recommended that <i>k</i> be a power of 2 to enable merging of sketches with
121+
* different values of <i>k</i>. However, in this case it is only possible to merge from
122+
* larger values of <i>k</i> to smaller values.
123+
*
119124
* @return a QuantilesSketch
120125
*/
121126
public QuantilesSketch build(int k) {

src/test/java/com/yahoo/sketches/quantiles/HeapQuantilesSketchTest.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -702,6 +702,14 @@ public void checkGetSeed() {
702702
assertEquals(qs1.getSeed(), 0);
703703
}
704704

705+
@Test(expectedExceptions = IllegalArgumentException.class)
706+
public void checkImproperBuild() {
707+
Memory mem = new NativeMemory(new byte[1024]);
708+
@SuppressWarnings("unused")
709+
QuantilesSketch qs1 = QuantilesSketch.builder().initMemory(mem).build(4);
710+
711+
}
712+
705713
@Test
706714
public void checkKisOne() {
707715
QuantilesSketch qs1 = QuantilesSketch.builder().build(1);

0 commit comments

Comments
 (0)