You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datasketches.apache.org by jm...@apache.org on 2024/03/01 04:29:56 UTC
(datasketches-java) 04/07: Removed commented-out code
This is an automated email from the ASF dual-hosted git repository.
jmalkin pushed a commit to branch 5.0.X-backport
in repository https://gitbox.apache.org/repos/asf/datasketches-java.git
commit f268943a2ecb424366491cb2fbf4c9075a5de3c7
Author: Lee Rhodes <le...@users.noreply.github.com>
AuthorDate: Sat Feb 24 09:23:47 2024 -0800
Removed commented-out code
---
.../datasketches/kll/KllItemsSketchSortedView.java | 2 +-
.../quantiles/ItemsSketchSortedView.java | 100 ---------------------
2 files changed, 1 insertion(+), 101 deletions(-)
diff --git a/src/main/java/org/apache/datasketches/kll/KllItemsSketchSortedView.java b/src/main/java/org/apache/datasketches/kll/KllItemsSketchSortedView.java
index 553b93af..0fc91fb6 100644
--- a/src/main/java/org/apache/datasketches/kll/KllItemsSketchSortedView.java
+++ b/src/main/java/org/apache/datasketches/kll/KllItemsSketchSortedView.java
@@ -55,7 +55,7 @@ public class KllItemsSketchSortedView<T> implements GenericSortedView<T>, Partit
private final Class<T> clazz;
/**
- * Construct from elements for testing only.
+ * Construct from elements, also used in testing.
* @param quantiles sorted array of quantiles
* @param cumWeights sorted, monotonically increasing cumulative weights.
* @param totalN the total number of items presented to the sketch.
diff --git a/src/main/java/org/apache/datasketches/quantiles/ItemsSketchSortedView.java b/src/main/java/org/apache/datasketches/quantiles/ItemsSketchSortedView.java
index e9117b93..08df7210 100644
--- a/src/main/java/org/apache/datasketches/quantiles/ItemsSketchSortedView.java
+++ b/src/main/java/org/apache/datasketches/quantiles/ItemsSketchSortedView.java
@@ -80,40 +80,6 @@ public class ItemsSketchSortedView<T> implements GenericSortedView<T>, Partition
this.clazz = (Class<T>)quantiles[0].getClass();
}
-// /**
-// * Constructs this Sorted View given the sketch
-// * @param sketch the given Classic Quantiles ItemsSketch
-// */
-// @SuppressWarnings("unchecked")
-// ItemsSketchSortedView(final ItemsSketch<T> sketch) {
-// if (sketch.isEmpty()) { throw new SketchesArgumentException(EMPTY_MSG); }
-// this.totalN = sketch.getN();
-// final int numQuantiles = sketch.getNumRetained();
-// this.quantiles = (T[]) Array.newInstance(sketch.clazz, numQuantiles);
-// this.minItem = sketch.minItem_;
-// this.maxItem = sketch.maxItem_;
-// this.cumWeights = new long[numQuantiles];
-// this.comparator = sketch.getComparator();
-// this.clazz = sketch.clazz;
-// this.k = sketch.getK();
-//
-// final Object[] combinedBuffer = sketch.getCombinedBuffer();
-// final int baseBufferCount = sketch.getBaseBufferCount();
-//
-// // Populate from ItemsSketch:
-// // copy over the "levels" and then the base buffer, all with appropriate weights
-// populateFromItemsSketch(k, totalN, sketch.getBitPattern(), (T[]) combinedBuffer, baseBufferCount,
-// numQuantiles, quantiles, cumWeights, sketch.getComparator());
-//
-// // Sort the first "numSamples" slots of the two arrays in tandem,
-// // taking advantage of the already sorted blocks of length k
-// ItemsMergeImpl.blockyTandemMergeSort(quantiles, cumWeights, numQuantiles, k, sketch.getComparator());
-//
-// if (convertToCumulative(cumWeights) != totalN) {
-// throw new SketchesStateException("Sorted View is misconfigured. TotalN does not match cumWeights.");
-// }
-// }
-
//end of constructors
@Override
@@ -249,70 +215,4 @@ public class ItemsSketchSortedView<T> implements GenericSortedView<T>, Partition
return new GenericSortedViewIterator<>(quantiles, cumWeights);
}
- //restricted methods
-
-// /**
-// * Populate the arrays and registers from an ItemsSketch
-// * @param <T> the data type
-// * @param k K parameter of sketch
-// * @param n The current size of the stream
-// * @param bitPattern the bit pattern for valid log levels
-// * @param combinedBuffer the combined buffer reference
-// * @param baseBufferCount the count of the base buffer
-// * @param numQuantiles number of retained quantiles in the sketch
-// * @param quantilesArr the consolidated array of all quantiles from the sketch
-// * @param weightsArr the weights for each item from the sketch
-// * @param comparator the given comparator for data type T
-// */
-// private final static <T> void populateFromItemsSketch(
-// final int k, final long n, final long bitPattern, final T[] combinedBuffer,
-// final int baseBufferCount, final int numQuantiles, final T[] quantilesArr, final long[] weightsArr,
-// final Comparator<? super T> comparator) {
-// long weight = 1;
-// int nxt = 0;
-// long bits = bitPattern;
-// assert bits == (n / (2L * k)); // internal consistency check
-// for (int lvl = 0; bits != 0L; lvl++, bits >>>= 1) {
-// weight *= 2;
-// if ((bits & 1L) > 0L) {
-// final int offset = (2 + lvl) * k;
-// for (int i = 0; i < k; i++) {
-// quantilesArr[nxt] = combinedBuffer[i + offset];
-// weightsArr[nxt] = weight;
-// nxt++;
-// }
-// }
-// }
-//
-// weight = 1; //NOT a mistake! We just copied the highest level; now we need to copy the base buffer
-// final int startOfBaseBufferBlock = nxt;
-//
-// // Copy BaseBuffer over, along with weight = 1
-// for (int i = 0; i < baseBufferCount; i++) {
-// quantilesArr[nxt] = combinedBuffer[i];
-// weightsArr[nxt] = weight;
-// nxt++;
-// }
-// assert nxt == numQuantiles;
-//
-// // Must sort the items that came from the base buffer.
-// // Don't need to sort the corresponding weights because they are all the same.
-// Arrays.sort(quantilesArr, startOfBaseBufferBlock, numQuantiles, comparator);
-// }
-//
-// /**
-// * Convert the individual weights into cumulative weights.
-// * An array of {1,1,1,1} becomes {1,2,3,4}
-// * @param array of actual weights from the sketch, none of the weights may be zero
-// * @return total weight
-// */
-// private static long convertToCumulative(final long[] array) {
-// long subtotal = 0;
-// for (int i = 0; i < array.length; i++) {
-// final long newSubtotal = subtotal + array[i];
-// subtotal = array[i] = newSubtotal;
-// }
-// return subtotal;
-// }
-
}
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datasketches.apache.org
For additional commands, e-mail: commits-help@datasketches.apache.org