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


##########
processing/src/main/java/org/apache/druid/segment/serde/ComplexMetricSerde.java:
##########
@@ -115,11 +115,13 @@ public Function<Object, Long> inputSizeFn()
    */
   public byte[] toBytes(@Nullable Object val)
   {
-    if (val != null) {
+    if (val == null) {
+      return ByteArrays.EMPTY_ARRAY;
+    } else if (val instanceof byte[]) {
+      return (byte[]) val;
+    } else {

Review Comment:
   I think this is incorrect because there might exist a serde where the 
deserialized value is byte[], however, the serialized value can be something 
else. 
   
   For example, different compression techniques can transform a deserialized 
byte[] array to a different serialized byte[] array. This would be unique to 
the complex type, so it shouldn't be a universal change. Instead, the following 
changes can be made:
   
   1. If this only occurs in the HllSketchBuild serde, you can make this change 
specific to the HllSketchBuild serde. 
   2. Else, if this occurs with all the complex types while running MSQ tasks 
on complex metrics, you can make the changes in MSQ-specific classes (after 
confirming where the byte[] array is coming from). 



-- 
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