jihoonson commented on a change in pull request #5958: Part 2 of changes for 
SQL Compatible Null Handling
URL: https://github.com/apache/incubator-druid/pull/5958#discussion_r204941324
 
 

 ##########
 File path: 
processing/src/main/java/io/druid/query/aggregation/post/DoubleGreatestPostAggregator.java
 ##########
 @@ -81,13 +77,15 @@ public Comparator getComparator()
   public Object compute(Map<String, Object> values)
   {
     Iterator<PostAggregator> fieldsIter = fields.iterator();
-    double retVal = Double.NEGATIVE_INFINITY;
-    if (fieldsIter.hasNext()) {
-      retVal = ((Number) fieldsIter.next().compute(values)).doubleValue();
-      while (fieldsIter.hasNext()) {
-        double other = ((Number) 
fieldsIter.next().compute(values)).doubleValue();
-        if (other > retVal) {
-          retVal = other;
+    Double retVal = NullHandling.replaceWithDefault() ? 
Double.NEGATIVE_INFINITY : null;
+    while (fieldsIter.hasNext()) {
+      Number nextVal = ((Number) fieldsIter.next().compute(values));
 
 Review comment:
   It looks that we need specialized `PostAggregator` for primitive types and a 
new method `isNull()` to avoid boxing/unboxing. Would you file an issue for 
this?

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@druid.apache.org
For additional commands, e-mail: dev-h...@druid.apache.org

Reply via email to