clintropolis commented on a change in pull request #10088:
URL: https://github.com/apache/druid/pull/10088#discussion_r446727236



##########
File path: 
extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchComplexMetricSerde.java
##########
@@ -77,7 +78,7 @@ public Object extractValue(final InputRow inputRow, final 
String metricName)
           // This corresponds to "A" in base64, so it is not a digit
           if (objectString.isEmpty()) {
             return DoublesSketchOperations.EMPTY_SKETCH;
-          } else if (Character.isDigit(objectString.charAt(0))) {
+          } else if (NumberUtils.isParsable(objectString)) {

Review comment:
       Since this method is going to look at every character of the string to 
check if it's a number, I wonder if it's better to just try to parse it to a 
double and then use it if it's not null, maybe
   ```java
   ...
             final Double doubleValue;
             if (objectString.isEmpty()) {
               return DoublesSketchOperations.EMPTY_SKETCH;
             } else if ((doubleValue = Doubles.tryParse(objectString)) != null) 
{
               UpdateDoublesSketch sketch = 
DoublesSketch.builder().setK(MIN_K).build();
               sketch.update(doubleValue);
               return sketch;
             }
   ...
   ```




----------------------------------------------------------------
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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to