adarshsanjeev commented on code in PR #15162:
URL: https://github.com/apache/druid/pull/15162#discussion_r1363233247


##########
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchHolderObjectStrategy.java:
##########
@@ -67,4 +74,32 @@ public HllSketchHolder fromByteBufferSafe(ByteBuffer buffer, 
int numBytes)
         )
     );
   }
+
+  private boolean isSafeToConvertToNullSketch(ByteBuffer buf)
+  {
+    // TODO: Might need a sanity check here, to ensure that position and 
offset makes sense.
+
+    // Get org.apache.datasketches.hll.CurMode. This indicates the type of 
data structure.
+    final int position = buf.position();
+    final int preInts = buf.get(position) & 0X3F; // get(PREAMBLE_INTS_BYTE) & 
0X3F
+    final int curMode = buf.get(position + 7) & 3;    // get(MODE_BYTE) & 
CUR_MODE_MASK
+
+    switch (curMode) {
+      case 0:          // LIST
+        Preconditions.checkArgument(preInts == 2);  // preInts == 
LIST_PREINTS, Sanity

Review Comment:
   Changed the code here to return false instead. I think the point about using 
DruidException instead of Guava makes sense.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to