xiangfu0 commented on code in PR #20027:
URL: https://github.com/apache/pinot/pull/20027#discussion_r4369977429


##########
pinot-spi/src/main/java/org/apache/pinot/spi/data/FieldSpec.java:
##########
@@ -880,6 +950,12 @@ public Object convert(String value) {
             return value;
           case BYTES:
             return BytesUtils.toBytes(value);
+          case VARIANT:
+            byte[] envelope = BytesUtils.toBytes(value);
+            if (envelope.length != 0) {
+              VariantEnvelope.decode(envelope);

Review Comment:
   Minor: `convert`/`convertInternal` validate by calling 
`VariantEnvelope.decode(envelope)` and discarding the result, which allocates a 
`Decoded` plus two `ByteBuffer` slices just to throw them away. 
`PinotDataType.VARIANT` already uses the lighter `validateAndGetMetadataLength` 
for the same check. Consider using the same here so both validation paths 
behave and allocate identically.



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