arunkumarucet commented on code in PR #17485:
URL: https://github.com/apache/pinot/pull/17485#discussion_r2678753167


##########
pinot-spi/src/main/java/org/apache/pinot/spi/utils/JsonUtils.java:
##########
@@ -247,6 +247,20 @@ public static Map<String, Object> jsonNodeToMap(JsonNode 
jsonNode)
     return DEFAULT_READER.forType(MAP_TYPE_REFERENCE).readValue(jsonNode);
   }
 
+  /**
+   * Parses JSON bytes directly to a Map, avoiding the intermediate JsonNode 
representation.
+   * This is more efficient than calling bytesToJsonNode followed by 
jsonNodeToMap.
+   */
+  public static Map<String, Object> bytesToMap(byte[] jsonBytes)
+      throws IOException {
+    return DEFAULT_READER.forType(MAP_TYPE_REFERENCE).readValue(jsonBytes);
+  }
+
+  public static Map<String, Object> bytesToMap(byte[] jsonBytes, int offset, 
int length)
+      throws IOException {
+    return DEFAULT_READER.forType(MAP_TYPE_REFERENCE).readValue(jsonBytes, 
offset, offset + length);

Review Comment:
   Yeah, I've fixed the code and also added more test coverage for offset



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