amrishlal commented on a change in pull request #7057:
URL: https://github.com/apache/incubator-pinot/pull/7057#discussion_r655866156



##########
File path: 
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java
##########
@@ -105,210 +105,298 @@ public TransformResultMetadata getResultMetadata() {
 
   @Override
   public int[] transformToIntValuesSV(ProjectionBlock projectionBlock) {
-    final String[] stringValuesSV = 
_jsonFieldTransformFunction.transformToStringValuesSV(projectionBlock);
-    final int[] results = new int[projectionBlock.getNumDocs()];
-    for (int i = 0; i < results.length; i++) {
-      Object read = 
JSON_PARSER_CONTEXT.parse(stringValuesSV[i]).read(_jsonPath);
-      if (read == null) {
+    if (_intValuesSV == null) {
+      _intValuesSV = new int[DocIdSetPlanNode.MAX_DOC_PER_CALL];
+    }
+
+    String[] jsonStrings = 
_jsonFieldTransformFunction.transformToStringValuesSV(projectionBlock);
+    int numDocs = projectionBlock.getNumDocs();
+    for (int i = 0; i < numDocs; i++) {
+      Object result = null;
+      try {
+        result = JSON_PARSER_CONTEXT.parse(jsonStrings[i]).read(_jsonPath);
+      } catch (Exception ignored) {

Review comment:
       I think we should not be catching exceptions here mainly because 
JSON_PARSER_CONTEXT has been declared to suppress exceptions already:
   
   ```
     private static final ParseContext JSON_PARSER_CONTEXT =
         
JsonPath.using(Configuration.defaultConfiguration().addOptions(Option.SUPPRESS_EXCEPTIONS));
   ```
   If for some reason, it does throw exception even with SUPPRESS_EXCEPTIONS 
option turned on, then we would like to know about that (as that would be a 
bug). Is there a specific case that you encountered that made caching exception 
here necessary?




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

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



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

Reply via email to