Package net.agkn.hll

Examples of net.agkn.hll.HLL.addRaw()


            for(int regw=MINIMUM_REGWIDTH_PARAM; regw<=MAXIMUM_REGWIDTH_PARAM; regw++) {
                for(int expthr=MINIMUM_EXPTHRESH_PARAM; expthr<=MAXIMUM_EXPTHRESH_PARAM; expthr++ ) {
                    for(final boolean sparse: new boolean[]{true, false}) {
                        HLL hll = new HLL(log2m, regw, expthr, sparse, hllType);
                        for(final Long item: items) {
                            hll.addRaw(item);
                        }
                        HLL copy = HLL.fromBytes(hll.toBytes());
                        assertEquals(copy.cardinality(), hll.cardinality());
                        assertEquals(copy.getType(), hll.getType());
                        assertEquals(copy.toBytes(), hll.toBytes());
View Full Code Here


        //        and the declared type of the "receiving" field.
        //        It is the manually-constructed union result.

        // "underpopulated" FULL U EMPTY => SPARSE
        final HLL fullHLL = newHLL(HLLType.FULL);
        fullHLL.addRaw(constructHLLValue(LOG2M, 0/*ix*/, 1/*val*/));

        final HLL sparseHLL = newHLL(HLLType.SPARSE);
        sparseHLL.addRaw(constructHLLValue(LOG2M, 0/*ix*/, 1/*val*/));

        output.write(stringCardinality(fullHLL) + "," + toByteA(fullHLL, schemaVersion) + "," + stringCardinality(sparseHLL) + "," + toByteA(sparseHLL, schemaVersion) + "\n");
View Full Code Here

        // "underpopulated" FULL U EMPTY => SPARSE
        final HLL fullHLL = newHLL(HLLType.FULL);
        fullHLL.addRaw(constructHLLValue(LOG2M, 0/*ix*/, 1/*val*/));

        final HLL sparseHLL = newHLL(HLLType.SPARSE);
        sparseHLL.addRaw(constructHLLValue(LOG2M, 0/*ix*/, 1/*val*/));

        output.write(stringCardinality(fullHLL) + "," + toByteA(fullHLL, schemaVersion) + "," + stringCardinality(sparseHLL) + "," + toByteA(sparseHLL, schemaVersion) + "\n");
        output.flush();

        // "underpopulated" FULL (small) U SPARSE (small) => SPARSE
View Full Code Here

        output.write(stringCardinality(fullHLL) + "," + toByteA(fullHLL, schemaVersion) + "," + stringCardinality(sparseHLL) + "," + toByteA(sparseHLL, schemaVersion) + "\n");
        output.flush();

        // "underpopulated" FULL (small) U SPARSE (small) => SPARSE
        final HLL fullHLL2 = newHLL(HLLType.FULL);
        fullHLL2.addRaw(constructHLLValue(LOG2M, 1/*ix*/, 1/*val*/));

        sparseHLL.addRaw(constructHLLValue(LOG2M, 1/*ix*/, 1/*val*/));

        output.write(stringCardinality(fullHLL2) + "," + toByteA(fullHLL2, schemaVersion) + "," + stringCardinality(sparseHLL) + "," + toByteA(sparseHLL, schemaVersion) + "\n");
        output.flush();
View Full Code Here

        output.flush();

        // "underpopulated" FULL (just on edge) U SPARSE (small) => FULL
        final HLL fullHLL3 = newHLL(HLLType.FULL);
        for(int i=2; i<(SPARSE_THRESHOLD + 1); i++) {
            fullHLL3.addRaw(constructHLLValue(LOG2M, i/*ix*/, 1/*val*/));
            sparseHLL.addRaw(constructHLLValue(LOG2M, i/*ix*/, 1/*val*/));
        }

        output.write(stringCardinality(fullHLL3) + "," + toByteA(fullHLL3, schemaVersion) + "," + stringCardinality(sparseHLL) + "," + toByteA(sparseHLL, schemaVersion) + "\n");
        output.flush();
View Full Code Here

        cumulativeUnionLine(output, hll, emptyHLL, schemaVersion);

        for(int i=0; i<(EXPLICIT_THRESHOLD+500)/*should be greater than promotion cutoff*/; i++) {
            // make an EXPLICIT set and populate with cardinality 1
            final HLL explicitHLL = newHLL(HLLType.EXPLICIT);
            explicitHLL.addRaw(random.nextLong());

            cumulativeUnionLine(output, hll, explicitHLL, schemaVersion);
        }

        output.flush();
View Full Code Here

            final HLL sparseHLL = newHLL(HLLType.SPARSE);

            final int registerIndex = Math.abs(random.nextInt()) % REGISTER_COUNT;
            final int registerValue = ((Math.abs(random.nextInt()) % REGISTER_MAX_VALUE) + 1);
            final long rawValue = constructHLLValue(LOG2M, registerIndex, registerValue);
            sparseHLL.addRaw(rawValue);

            cumulativeUnionLine(output, hll, sparseHLL, schemaVersion);
        }

        output.flush();
View Full Code Here

        cumulativeUnionLine(output, hll, emptyHLL, schemaVersion);

        for(int i=0; i<EXPLICIT_THRESHOLD; i++) {
            // make an EXPLICIT set and populate with cardinality 1
            final HLL explicitHLL = newHLL(HLLType.EXPLICIT);
            explicitHLL.addRaw(random.nextLong());

            // union it into the accumulator twice, to test overlap (cardinality should not change)
            cumulativeUnionLine(output, hll, explicitHLL, schemaVersion);
            cumulativeUnionLine(output, hll, explicitHLL, schemaVersion);
        }
View Full Code Here

            // make a SPARSE set and populate with cardinality 1
            final HLL sparseHLL = newHLL(HLLType.SPARSE);
            final int registerIndex = Math.abs(random.nextInt()) % REGISTER_COUNT;
            final int registerValue = ((Math.abs(random.nextInt()) % REGISTER_MAX_VALUE) + 1);
            final long rawValue = constructHLLValue(LOG2M, registerIndex, registerValue);
            sparseHLL.addRaw(rawValue);

            cumulativeUnionLine(output, hll, sparseHLL, schemaVersion);
        }

        output.flush();
View Full Code Here

        for(int i=0; i<1000/*number of rows to generate*/; i++) {
            // make a FULL set and populate with
            final HLL fullHLL = newHLL(HLLType.FULL);
            final int elementCount = random.nextInt(10000/*arbitrary maximum cardinality*/);
            for(int j=0;j<elementCount;j++) {
                fullHLL.addRaw(random.nextLong());
            }

            cumulativeUnionLine(output, hll, fullHLL, schemaVersion);
        }

View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.