Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

code cleanup #646

Merged
merged 1 commit into from
Feb 3, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,6 @@ private static CompactSketch wrap(final Memory srcMem, final long seed, final bo
final short seedHash = ThetaUtil.computeSeedHash(seed);

if (serVer == 4) {
// not wrapping the compressed format since currently we cannot take advantage of
// decompression during iteration because set operations reach into memory directly
return DirectCompactCompressedSketch.wrapInstance(srcMem,
enforceSeed ? seedHash : (short) extractSeedHash(srcMem));
}
Expand Down Expand Up @@ -251,6 +249,11 @@ public boolean isCompact() {
return true;
}

@Override
public double getEstimate() {
return Sketch.estimate(getThetaLong(), getRetainedEntries());
}

/**
* gets the sketch as a compressed byte array
* @return the sketch as a compressed byte array
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,8 @@ public boolean isOrdered() {
public HashIterator iterator() {
return new MemoryCompactCompressedHashIterator(
mem_,
(extractPreLongs(mem_) > 1 ? 16 : 8) + extractNumEntriesBytesV4(mem_),
(extractPreLongs(mem_) > 1 ? START_PACKED_DATA_ESTIMATION_MODE : START_PACKED_DATA_EXACT_MODE)
+ extractNumEntriesBytesV4(mem_),
extractEntryBitsV4(mem_),
getRetainedEntries()
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,6 @@ public int getCurrentBytes() {
return (preLongs + curCount) << 3;
}

@Override
public double getEstimate() {
return Sketch.estimate(getThetaLong(), getRetainedEntries());
}

@Override
public int getRetainedEntries(final boolean valid) { //compact is always valid
if (otherCheckForSingleItem(mem_)) { return 1; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,6 @@ public int getCurrentBytes() {
return (preLongs_ + curCount_) << 3;
}

@Override
public double getEstimate() {
return Sketch.estimate(thetaLong_, curCount_);
}

@Override
public int getRetainedEntries(final boolean valid) {
return curCount_;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@

import org.apache.datasketches.memory.Memory;

/**
* @author Lee Rhodes
/*
* This is to uncompress serial version 4 sketch incrementally
*/
class MemoryCompactCompressedHashIterator implements HashIterator {
private Memory mem;
Expand Down