You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by GitBox <gi...@apache.org> on 2022/04/07 08:58:09 UTC

[GitHub] [datasketches-java] davecromberge commented on a diff in pull request #390: Direct kll double

davecromberge commented on code in PR #390:
URL: https://github.com/apache/datasketches-java/pull/390#discussion_r844890777


##########
src/main/java/org/apache/datasketches/kll/KllDirectSketch.java:
##########
@@ -0,0 +1,195 @@
+/*
+ * 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.kll;
+
+import static org.apache.datasketches.kll.KllPreambleUtil.extractMinK;
+import static org.apache.datasketches.kll.KllPreambleUtil.extractK;
+import static org.apache.datasketches.kll.KllPreambleUtil.extractLevelZeroSortedFlag;
+import static org.apache.datasketches.kll.KllPreambleUtil.extractM;
+import static org.apache.datasketches.kll.KllPreambleUtil.extractN;
+import static org.apache.datasketches.kll.KllPreambleUtil.extractNumLevels;
+import static org.apache.datasketches.kll.KllPreambleUtil.insertMinK;
+import static org.apache.datasketches.kll.KllPreambleUtil.insertLevelZeroSortedFlag;
+import static org.apache.datasketches.kll.KllPreambleUtil.insertN;
+import static org.apache.datasketches.kll.KllPreambleUtil.insertNumLevels;
+import static org.apache.datasketches.kll.KllSketch.Error.TGT_IS_IMMUTABLE;
+
+import org.apache.datasketches.memory.MemoryRequestServer;
+import org.apache.datasketches.memory.WritableMemory;
+
+/**
+ * This class implements all the methods for the Direct (off-heap) sketches that are independent
+ * of the sketch type (float or double).
+ */
+abstract class KllDirectSketch extends KllSketch {
+  final boolean updatable = true;
+  WritableMemory levelsArrUpdatable;
+  WritableMemory minMaxArrUpdatable;
+  WritableMemory itemsArrUpdatable;
+
+  /**
+   * For the direct sketches it is important that the methods implemented here are designed to work dynamically
+   * as the sketch grows off-heap.
+   * @param sketchType either DOUBLE_SKETCH or FLOAT_SKETCH
+   * @param wmem the current WritableMemory
+   * @param memReqSvr the given MemoryRequestServer to request a larger WritableMemory
+   */

Review Comment:
   Thanks for clarifying, makes sense.



-- 
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: commits-unsubscribe@datasketches.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org