Skip to content

Commit f268943

Browse files
leerhojmalkin
authored andcommitted
Removed commented-out code
1 parent 6ae6956 commit f268943

File tree

2 files changed

+1
-101
lines changed

2 files changed

+1
-101
lines changed

src/main/java/org/apache/datasketches/kll/KllItemsSketchSortedView.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ public class KllItemsSketchSortedView<T> implements GenericSortedView<T>, Partit
5555
private final Class<T> clazz;
5656

5757
/**
58-
* Construct from elements for testing only.
58+
* Construct from elements, also used in testing.
5959
* @param quantiles sorted array of quantiles
6060
* @param cumWeights sorted, monotonically increasing cumulative weights.
6161
* @param totalN the total number of items presented to the sketch.

src/main/java/org/apache/datasketches/quantiles/ItemsSketchSortedView.java

Lines changed: 0 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -80,40 +80,6 @@ public class ItemsSketchSortedView<T> implements GenericSortedView<T>, Partition
8080
this.clazz = (Class<T>)quantiles[0].getClass();
8181
}
8282

83-
// /**
84-
// * Constructs this Sorted View given the sketch
85-
// * @param sketch the given Classic Quantiles ItemsSketch
86-
// */
87-
// @SuppressWarnings("unchecked")
88-
// ItemsSketchSortedView(final ItemsSketch<T> sketch) {
89-
// if (sketch.isEmpty()) { throw new SketchesArgumentException(EMPTY_MSG); }
90-
// this.totalN = sketch.getN();
91-
// final int numQuantiles = sketch.getNumRetained();
92-
// this.quantiles = (T[]) Array.newInstance(sketch.clazz, numQuantiles);
93-
// this.minItem = sketch.minItem_;
94-
// this.maxItem = sketch.maxItem_;
95-
// this.cumWeights = new long[numQuantiles];
96-
// this.comparator = sketch.getComparator();
97-
// this.clazz = sketch.clazz;
98-
// this.k = sketch.getK();
99-
//
100-
// final Object[] combinedBuffer = sketch.getCombinedBuffer();
101-
// final int baseBufferCount = sketch.getBaseBufferCount();
102-
//
103-
// // Populate from ItemsSketch:
104-
// // copy over the "levels" and then the base buffer, all with appropriate weights
105-
// populateFromItemsSketch(k, totalN, sketch.getBitPattern(), (T[]) combinedBuffer, baseBufferCount,
106-
// numQuantiles, quantiles, cumWeights, sketch.getComparator());
107-
//
108-
// // Sort the first "numSamples" slots of the two arrays in tandem,
109-
// // taking advantage of the already sorted blocks of length k
110-
// ItemsMergeImpl.blockyTandemMergeSort(quantiles, cumWeights, numQuantiles, k, sketch.getComparator());
111-
//
112-
// if (convertToCumulative(cumWeights) != totalN) {
113-
// throw new SketchesStateException("Sorted View is misconfigured. TotalN does not match cumWeights.");
114-
// }
115-
// }
116-
11783
//end of constructors
11884

11985
@Override
@@ -249,70 +215,4 @@ public GenericSortedViewIterator<T> iterator() {
249215
return new GenericSortedViewIterator<>(quantiles, cumWeights);
250216
}
251217

252-
//restricted methods
253-
254-
// /**
255-
// * Populate the arrays and registers from an ItemsSketch
256-
// * @param <T> the data type
257-
// * @param k K parameter of sketch
258-
// * @param n The current size of the stream
259-
// * @param bitPattern the bit pattern for valid log levels
260-
// * @param combinedBuffer the combined buffer reference
261-
// * @param baseBufferCount the count of the base buffer
262-
// * @param numQuantiles number of retained quantiles in the sketch
263-
// * @param quantilesArr the consolidated array of all quantiles from the sketch
264-
// * @param weightsArr the weights for each item from the sketch
265-
// * @param comparator the given comparator for data type T
266-
// */
267-
// private final static <T> void populateFromItemsSketch(
268-
// final int k, final long n, final long bitPattern, final T[] combinedBuffer,
269-
// final int baseBufferCount, final int numQuantiles, final T[] quantilesArr, final long[] weightsArr,
270-
// final Comparator<? super T> comparator) {
271-
// long weight = 1;
272-
// int nxt = 0;
273-
// long bits = bitPattern;
274-
// assert bits == (n / (2L * k)); // internal consistency check
275-
// for (int lvl = 0; bits != 0L; lvl++, bits >>>= 1) {
276-
// weight *= 2;
277-
// if ((bits & 1L) > 0L) {
278-
// final int offset = (2 + lvl) * k;
279-
// for (int i = 0; i < k; i++) {
280-
// quantilesArr[nxt] = combinedBuffer[i + offset];
281-
// weightsArr[nxt] = weight;
282-
// nxt++;
283-
// }
284-
// }
285-
// }
286-
//
287-
// weight = 1; //NOT a mistake! We just copied the highest level; now we need to copy the base buffer
288-
// final int startOfBaseBufferBlock = nxt;
289-
//
290-
// // Copy BaseBuffer over, along with weight = 1
291-
// for (int i = 0; i < baseBufferCount; i++) {
292-
// quantilesArr[nxt] = combinedBuffer[i];
293-
// weightsArr[nxt] = weight;
294-
// nxt++;
295-
// }
296-
// assert nxt == numQuantiles;
297-
//
298-
// // Must sort the items that came from the base buffer.
299-
// // Don't need to sort the corresponding weights because they are all the same.
300-
// Arrays.sort(quantilesArr, startOfBaseBufferBlock, numQuantiles, comparator);
301-
// }
302-
//
303-
// /**
304-
// * Convert the individual weights into cumulative weights.
305-
// * An array of {1,1,1,1} becomes {1,2,3,4}
306-
// * @param array of actual weights from the sketch, none of the weights may be zero
307-
// * @return total weight
308-
// */
309-
// private static long convertToCumulative(final long[] array) {
310-
// long subtotal = 0;
311-
// for (int i = 0; i < array.length; i++) {
312-
// final long newSubtotal = subtotal + array[i];
313-
// subtotal = array[i] = newSubtotal;
314-
// }
315-
// return subtotal;
316-
// }
317-
318218
}

0 commit comments

Comments
 (0)