Skip to content
This repository was archived by the owner on Jul 7, 2020. It is now read-only.

Commit e525d4a

Browse files
committed
Merge pull request #9 from jkff/cte-loglog
CountThenEstimate supports LogLog
2 parents 65d000e + 0297117 commit e525d4a

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/main/java/com/clearspring/analytics/stream/cardinality/CountThenEstimate.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,8 @@ public class CountThenEstimate implements ICardinality, Externalizable
4747
protected final static byte LC = 1;
4848
protected final static byte AC = 2;
4949
protected final static byte HLC = 3;
50-
50+
protected final static byte LLC = 4;
51+
5152
/**
5253
* Cardinality after which exact counting gives way to estimation
5354
*/
@@ -224,6 +225,9 @@ public void readExternal(ObjectInput in) throws IOException, ClassNotFoundExcept
224225
case HLC:
225226
estimator = HyperLogLog.Builder.build(bytes);
226227
break;
228+
case LLC:
229+
estimator = new LinearCounting(bytes);
230+
break;
227231
default:
228232
throw new IOException("Unrecognized estimator type: "+type);
229233
}
@@ -262,6 +266,10 @@ else if(estimator instanceof HyperLogLog)
262266
{
263267
out.writeByte(HLC);
264268
}
269+
else if(estimator instanceof LogLog)
270+
{
271+
out.writeByte(LLC);
272+
}
265273
else throw new IOException("Estimator unsupported for serialization: "+estimator.getClass().getName());
266274

267275
byte[] bytes = estimator.getBytes();

0 commit comments

Comments
 (0)