Jackie-Jiang commented on code in PR #19836:
URL: https://github.com/apache/pinot/pull/19836#discussion_r4264920727


##########
pinot-core/src/main/java/org/apache/pinot/core/common/ObjectSerDeUtils.java:
##########
@@ -329,6 +332,22 @@ public interface ObjectSerDe<T> {
     /// Serializes a value into a byte array.
     byte[] serialize(T value);

Review Comment:
   Can we make the byte-array serializer a default method and remove the 
repeated allocation-and-delegation overrides from the six direct-writing codecs?
   
   ```java
   default byte[] serialize(T value) {
     byte[] bytes = new byte[getSerializedSize(value)];
     serialize(value, ByteBuffer.wrap(bytes));
     return bytes;
   }
   ```
   
   Keep the buffer serializer's existing default implementation, and document 
that each codec must override either the byte-array serializer or both 
`getSerializedSize` and the buffer serializer. No explicit negative-size check 
is needed here; array allocation already throws for the default `-1`.



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