You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@druid.apache.org by GitBox <gi...@apache.org> on 2020/06/29 01:42:22 UTC

[GitHub] [druid] clintropolis commented on a change in pull request #10088: Add integration tests for all InputFormat

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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@druid.apache.org
For additional commands, e-mail: commits-help@druid.apache.org