Skip to content

Commit 193cfdf

Browse files
committed
Completely remove SerVer 1 and 2 from the code.
1 parent b5639e8 commit 193cfdf

11 files changed

Lines changed: 3 additions & 1286 deletions

File tree

src/main/java/org/apache/datasketches/theta/CompactSketch.java

Lines changed: 1 addition & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -117,15 +117,7 @@ private static CompactSketch heapify(final MemorySegment srcSeg, final long seed
117117
if (enforceSeed && !empty) { PreambleUtil.checkSegmentSeedHash(srcSeg, seed); }
118118
return CompactOperations.segmentToCompact(srcSeg, srcOrdered, null);
119119
}
120-
//not SerVer 3, assume compact stored form
121-
final short seedHash = Util.computeSeedHash(seed);
122-
if (serVer == 1) {
123-
return ForwardCompatibility.heapify1to3(srcSeg, seedHash);
124-
}
125-
if (serVer == 2) {
126-
return ForwardCompatibility.heapify2to3(srcSeg,
127-
enforceSeed ? seedHash : (short) extractSeedHash(srcSeg));
128-
}
120+
//not SerVer 3 or 4
129121
throw new SketchesArgumentException("Unknown Serialization Version: " + serVer);
130122
}
131123

@@ -191,13 +183,6 @@ private static CompactSketch wrap(final MemorySegment srcSeg, final long seed, f
191183
final short seedHash = Util.computeSeedHash(seed);
192184

193185
switch (serVer) {
194-
case 1: {
195-
return ForwardCompatibility.heapify1to3(srcSeg, seedHash);
196-
}
197-
case 2: {
198-
return ForwardCompatibility.heapify2to3(srcSeg,
199-
enforceSeed ? seedHash : (short) extractSeedHash(srcSeg));
200-
}
201186
case 3: {
202187
if (PreambleUtil.isEmptyFlag(srcSeg)) {
203188
return EmptyCompactSketch.getHeapInstance(srcSeg);
@@ -294,13 +279,6 @@ private static CompactSketch wrap(final byte[] bytes, final long seed, final boo
294279
final short seedHash = Util.computeSeedHash(seed);
295280

296281
switch (serVer) {
297-
case 1: {
298-
return ForwardCompatibility.heapify1to3(MemorySegment.ofArray(bytes), seedHash);
299-
}
300-
case 2: {
301-
return ForwardCompatibility.heapify2to3(MemorySegment.ofArray(bytes),
302-
enforceSeed ? seedHash : getShortLE(bytes, SEED_HASH_SHORT));
303-
}
304282
case 3: {
305283
final int flags = bytes[FLAGS_BYTE];
306284
if ((flags & EMPTY_FLAG_MASK) > 0) {

src/main/java/org/apache/datasketches/theta/ForwardCompatibility.java

Lines changed: 0 additions & 165 deletions
This file was deleted.

0 commit comments

Comments
 (0)