use of com.yahoo.sketches.ArrayOfDoublesSerDe in project sketches-core by DataSketches.
the class ReservoirItemsUnionTest method checkBadFamily.
@Test(expectedExceptions = SketchesArgumentException.class)
public void checkBadFamily() {
final ReservoirItemsUnion<Double> rlu = ReservoirItemsUnion.newInstance(1024);
final WritableMemory mem = WritableMemory.wrap(rlu.toByteArray(new ArrayOfDoublesSerDe()));
// corrupt the family ID
mem.putByte(FAMILY_BYTE, (byte) 0);
ReservoirItemsUnion.heapify(mem, new ArrayOfDoublesSerDe());
fail();
}
use of com.yahoo.sketches.ArrayOfDoublesSerDe in project sketches-core by DataSketches.
the class ItemsSketchTest method compactNotSupported.
@Test(expectedExceptions = SketchesArgumentException.class)
public void compactNotSupported() {
ArrayOfDoublesSerDe serDe = new ArrayOfDoublesSerDe();
ItemsSketch<Double> sketch = ItemsSketch.getInstance(Comparator.naturalOrder());
byte[] byteArr = sketch.toByteArray(serDe);
WritableMemory mem = WritableMemory.wrap(byteArr);
mem.clearBits(PreambleUtil.FLAGS_BYTE, (byte) PreambleUtil.COMPACT_FLAG_MASK);
println(PreambleUtil.toString(mem, false));
ItemsSketch.getInstance(mem, Comparator.naturalOrder(), serDe);
}
Aggregations