leerho commented on code in PR #475:
URL: https://github.com/apache/datasketches-java/pull/475#discussion_r1396487079


##########
src/test/java/org/apache/datasketches/partitions/ItemsSketchFillRequestLongAsString.java:
##########
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.datasketches.partitions;
+
+import static org.apache.datasketches.partitions.BoundsRule.INCLUDE_BOTH;
+import static org.apache.datasketches.partitions.BoundsRule.INCLUDE_UPPER;
+import static 
org.apache.datasketches.quantilescommon.LongsAsOrderableStrings.digits;
+import static 
org.apache.datasketches.quantilescommon.LongsAsOrderableStrings.getString;
+
+import java.util.Comparator;
+import java.util.Random;
+
+import org.apache.datasketches.quantiles.ItemsSketch;
+
+/**
+ * This is an simulated data set with a given N used for testing.
+ * @author Lee Rhodes
+ */
+public class ItemsSketchFillRequestLongAsString implements 
SketchFillRequest<String, ItemsSketch<String>> {
+  private int k;
+  private int numDigits;
+  private Random rand = new Random();
+
+  public ItemsSketchFillRequestLongAsString() {
+    k = 1 << 10;
+    numDigits = 3;
+  }
+
+  public ItemsSketchFillRequestLongAsString(final int k, final long totalN) {
+    this.k = k;
+    this.numDigits = digits(totalN);
+  }
+
+  @Override
+  public ItemsSketch<String> getRange(final String lowerQuantile, final String 
upperQuantile,
+      final BoundsRule bounds) {
+    final ItemsSketch<String> sk = ItemsSketch.getInstance(String.class, k, 
Comparator.naturalOrder());
+    final long lower = Long.parseLong(lowerQuantile.trim());
+    final long upper = Long.parseLong(upperQuantile.trim());

Review Comment:
   Fixed.



##########
src/test/java/org/apache/datasketches/partitions/KllItemsSketchFillRequestLongAsString.java:
##########
@@ -0,0 +1,121 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.datasketches.partitions;
+
+import static org.apache.datasketches.partitions.BoundsRule.INCLUDE_BOTH;
+import static org.apache.datasketches.partitions.BoundsRule.INCLUDE_UPPER;
+import static 
org.apache.datasketches.quantilescommon.LongsAsOrderableStrings.digits;
+import static 
org.apache.datasketches.quantilescommon.LongsAsOrderableStrings.getString;
+
+import java.util.Comparator;
+import java.util.Random;
+
+import org.apache.datasketches.common.ArrayOfStringsSerDe;
+import org.apache.datasketches.kll.KllItemsSketch;
+
+/**
+ * This is an simulated data set with a given N used for testing.
+ * @author Lee Rhodes
+ */
+public class KllItemsSketchFillRequestLongAsString implements 
SketchFillRequest<String, KllItemsSketch<String>> {
+  private int k;
+  private int numDigits;
+  private Random rand = new Random();
+
+  public KllItemsSketchFillRequestLongAsString() {
+    k = 1 << 10;
+    numDigits = 3;
+  }
+
+  public KllItemsSketchFillRequestLongAsString(final int k, final long totalN) 
{
+    this.k = k;
+    this.numDigits = digits(totalN);
+  }
+
+  @Override
+  public KllItemsSketch<String> getRange(final String lowerQuantile, final 
String upperQuantile,
+      final BoundsRule bounds) {
+    KllItemsSketch<String> sk = KllItemsSketch.newHeapInstance(k, 
Comparator.naturalOrder(), new ArrayOfStringsSerDe());
+    long lower = Long.parseLong(lowerQuantile.trim());

Review Comment:
   Fixed.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to