Jackie-Jiang commented on a change in pull request #7057: URL: https://github.com/apache/incubator-pinot/pull/7057#discussion_r655920186
########## 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: The parser will throw exception when input json string is `"null"` (this is a valid json, and I would count this as a bug in `JsonPath` library) or invalid json (e.g. `"{1"`). If default value is provided, we should return the default value when encountering exception so that user can still get the result for the valid values. When default value is not there, we will throw the exception. -- 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