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

Deserialization of MergingDigest BuferUnderflowException in 3.1 #90

Closed
manolama opened this issue Jun 9, 2017 · 5 comments
Closed

Deserialization of MergingDigest BuferUnderflowException in 3.1 #90

manolama opened this issue Jun 9, 2017 · 5 comments

Comments

@manolama
Copy link

manolama commented Jun 9, 2017

Heya, I'm writing an adaptor and noticed that if I create and serialize a MergingDigest, I can't deserialize it. Instead I have to switch to the AVLTreeDigest implementation. Is that intentional? An example test:

@Test
  public void mergingDigestSerDes() throws Exception {
    final TDigest out = MergingDigest.createDigest(100);
    out.add(42.5);
    out.add(1);
    out.add(24.0);
    assertEquals(40.649, out.quantile(0.95), 0.001);
    
    final ByteBuffer output = ByteBuffer.allocate(out.smallByteSize());
    out.asSmallBytes(output);
    
    ByteBuffer input = ByteBuffer.wrap(output.array());
    try {
      MergingDigest.fromBytes(input);
    } catch (BufferUnderflowException e) {
      System.out.println("WTF?");
    }
    
    input = ByteBuffer.wrap(output.array());
    final TDigest in = AVLTreeDigest.fromBytes(input);
    assertEquals(40.649, in.quantile(0.95), 0.001);
  }

And from #52 , I'd like solution number 2 where the type of tree is also encoded in the byte array.

@tdunning
Copy link
Owner

tdunning commented Jun 9, 2017 via email

@PerthCharern
Copy link

I'm using master but I'm still getting this BufferUnderflowException when trying to do MergingDigest.fromBytes as well.

org.apache.spark.SparkException: Job aborted due to stage failure: Task 2 in stage 4.0 failed 4 times, most recent failure: Lost task 2.3 in stage 4.0 (TID 83, 10.0.0.16): java.nio.BufferUnderflowException
at java.nio.Buffer.nextGetIndex(Buffer.java:506)
at java.nio.HeapByteBuffer.getDouble(HeapByteBuffer.java:514)
at com.tdunning.math.stats.MergingDigest.fromBytes(MergingDigest.java:678)

@tdunning
Copy link
Owner

tdunning commented Jun 13, 2017 via email

@tdunning
Copy link
Owner

tdunning commented Aug 2, 2017

Ah...

I just looked at your code.

The problem is that the serialization format isn't the same for the different t-digest implementations.

We are looking at how to deal with that now under the topic of universal serialization.

For now, this isn't intended to work. (but it will work before long)

@tdunning
Copy link
Owner

tdunning commented Aug 6, 2017

OK.

There was also a bug in the test case for this that was preventing any testing of the large format.

This should be all better now.

Will be included in 3.2 release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants