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


##########
pinot-segment-local/src/main/java/org/apache/pinot/segment/local/aggregator/PercentileEstValueAggregator.java:
##########
@@ -62,12 +62,24 @@ public QuantileDigest applyRawValue(QuantileDigest value, 
Object rawValue) {
     if (rawValue instanceof byte[]) {
       value.merge(deserializeAggregatedValue((byte[]) rawValue));
     } else {
-      value.add(((Number) rawValue).longValue());
+      value.add(toLong(rawValue));
     }
     _maxByteSize = Math.max(_maxByteSize, value.getByteSize());
     return value;
   }
 
+  private static long toLong(Object rawValue) {
+    if (rawValue instanceof Number) {
+      return ((Number) rawValue).longValue();
+    }
+    String stringValue = rawValue.toString();
+    try {
+      return Long.parseLong(stringValue);
+    } catch (NumberFormatException e) {
+      return (long) Double.parseDouble(stringValue);
+    }
+  }
+

Review Comment:
   This logic is not generally applicable, thus put it as a private one



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