LakshSingla commented on code in PR #16068:
URL: https://github.com/apache/druid/pull/16068#discussion_r1570502719


##########
processing/src/main/java/org/apache/druid/query/filter/ArrayContainsElementFilter.java:
##########
@@ -108,7 +109,10 @@ public byte[] getCacheKey()
     final NullableTypeStrategy<Object> typeStrategy = 
elementMatchValueEval.type().getNullableStrategy();
     final int size = 
typeStrategy.estimateSizeBytes(elementMatchValueEval.value());
     final ByteBuffer valueBuffer = ByteBuffer.allocate(size);
-    typeStrategy.write(valueBuffer, elementMatchValueEval.value(), size);
+    if (typeStrategy.write(valueBuffer, elementMatchValueEval.value(), size) < 
0) {
+      // Defensive check, since the size had already been estimated from the 
same type strategy
+      throw DruidException.defensive("Unable to write the value");

Review Comment:
   value is the one provided in the filter, which the user provides. Therefore 
printing the value as well. LMK if that poses any risk that I haven't 
considered. 



-- 
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: commits-unsubscr...@druid.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@druid.apache.org
For additional commands, e-mail: commits-h...@druid.apache.org

Reply via email to