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

Fixes serialization of HDRHistogram in percentiles aggregations #12505

Merged
merged 1 commit into from Jul 28, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -89,7 +89,10 @@ protected void doReadFrom(StreamInput in) throws IOException {
keys[i] = in.readDouble();
}
long minBarForHighestToLowestValueRatio = in.readLong();
ByteBuffer stateBuffer = ByteBuffer.wrap(in.readByteArray());
final int serializedLen = in.readVInt();
byte[] bytes = new byte[serializedLen];
in.readBytes(bytes, 0, serializedLen);
ByteBuffer stateBuffer = ByteBuffer.wrap(bytes);
try {
state = DoubleHistogram.decodeFromCompressedByteBuffer(stateBuffer, minBarForHighestToLowestValueRatio);
} catch (DataFormatException e) {
Expand All @@ -107,8 +110,9 @@ protected void doWriteTo(StreamOutput out) throws IOException {
}
out.writeLong(state.getHighestToLowestValueRatio());
ByteBuffer stateBuffer = ByteBuffer.allocate(state.getNeededByteBufferCapacity());
state.encodeIntoCompressedByteBuffer(stateBuffer);
out.writeByteArray(stateBuffer.array());
final int serializedLen = state.encodeIntoCompressedByteBuffer(stateBuffer);
out.writeVInt(serializedLen);
out.writeBytes(stateBuffer.array(), 0, serializedLen);
out.writeBoolean(keyed);
}

Expand Down