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


##########
pinot-core/src/main/java/org/apache/pinot/core/operator/transform/function/JsonExtractScalarTransformFunction.java:
##########
@@ -184,8 +184,12 @@ public long[] transformToLongValuesSV(ValueBlock 
valueBlock) {
       if (result instanceof Number) {
         _longValuesSV[i] = ((Number) result).longValue();
       } else {
-        // Handle scientific notation
-        _longValuesSV[i] = (long) Double.parseDouble(result.toString());
+        try {

Review Comment:
   My suggestion would be:
   1. Use `Long.parseLong()` without extra try-catch
   2. Fall back to `BaseTransformFunction` if the result **stored** type 
doesn't match the function name (e.g. result stored type is `DOUBLE` but 
function name is `transformToLongValuesSV`)
   
   To demonstrate the second point, you can try calling 
`transformToLongValuesSV()` on `JSON_EXTRACT_SCALAR(..., 'DOUBLE')` which might 
fail if we only do 1 without 2



-- 
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: commits-unsubscr...@pinot.apache.org

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