File tree Expand file tree Collapse file tree
main/java/com/yahoo/sketches/quantiles
test/java/com/yahoo/sketches/quantiles Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -77,9 +77,9 @@ static DoublesUnionImpl heapifyInstance(final DoublesSketch sketch) {
7777 * @return a DoublesUnion object
7878 */
7979 static DoublesUnionImpl heapifyInstance (final Memory srcMem ) {
80- final long n = srcMem .getLong (PreambleUtil .N_LONG ) ;
80+ final int preLongs = srcMem .getByte (PreambleUtil .PREAMBLE_LONGS_BYTE ) & 0xFF ;
8181 final int k = srcMem .getShort (PreambleUtil .K_SHORT ) & 0xFFFF ;
82- final HeapUpdateDoublesSketch sketch = (n == 0 )
82+ final HeapUpdateDoublesSketch sketch = (preLongs == 1 )
8383 ? HeapUpdateDoublesSketch .newInstance (k )
8484 : HeapUpdateDoublesSketch .heapifyInstance (srcMem );
8585 final DoublesUnionImpl union = new DoublesUnionImpl (k );
Original file line number Diff line number Diff line change @@ -693,6 +693,15 @@ public void isSameResourceDirect() {
693693 Assert .assertFalse (union .isSameResource (mem2 ));
694694 }
695695
696+ @ SuppressWarnings ("unused" )
697+ @ Test
698+ public void checkSerDeIssue165 () {
699+ DoublesUnion union = DoublesUnion .builder ().build ();
700+ byte [] byteArr = union .toByteArray ();
701+ Memory mem = Memory .wrap (byteArr );
702+ DoublesUnion union2 = DoublesUnionBuilder .heapify (mem );
703+ }
704+
696705 @ Test
697706 public void printlnTest () {
698707 println ("PRINTING: " + this .getClass ().getName ());
You can’t perform that action at this time.
0 commit comments