From 4b176ad265581c04996e9180c9cd5001744cff90 Mon Sep 17 00:00:00 2001 From: Alexander Saydakov <13126686+AlexanderSaydakov@users.noreply.github.com> Date: Thu, 11 Jul 2019 17:17:53 -0700 Subject: [PATCH] force native order when wrapping ByteBuffer since Druid can have it set (#8055) incorrectly --- .../quantiles/DoublesSketchMergeBufferAggregator.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchMergeBufferAggregator.java b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchMergeBufferAggregator.java index f5a1e9dc17f..a4766ac10d1 100644 --- a/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchMergeBufferAggregator.java +++ b/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchMergeBufferAggregator.java @@ -28,6 +28,7 @@ import org.apache.druid.query.monomorphicprocessing.RuntimeShapeInspector; import org.apache.druid.segment.ColumnValueSelector; import java.nio.ByteBuffer; +import java.nio.ByteOrder; import java.util.IdentityHashMap; public class DoublesSketchMergeBufferAggregator implements BufferAggregator @@ -113,7 +114,7 @@ public class DoublesSketchMergeBufferAggregator implements BufferAggregator private WritableMemory getMemory(final ByteBuffer buffer) { - return memCache.computeIfAbsent(buffer, buf -> WritableMemory.wrap(buf)); + return memCache.computeIfAbsent(buffer, buf -> WritableMemory.wrap(buf, ByteOrder.LITTLE_ENDIAN)); } private void putUnion(final ByteBuffer buffer, final int position, final DoublesUnion union)