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/09/03 15:21:31 UTC

[GitHub] [druid] suneet-s commented on a change in pull request #10340: Fix VARIANCE aggregator comparator

suneet-s commented on a change in pull request #10340:
URL: https://github.com/apache/druid/pull/10340#discussion_r483061296



##########
File path: extensions-core/stats/src/main/java/org/apache/druid/query/aggregation/variance/VarianceAggregatorCollector.java
##########
@@ -60,11 +60,11 @@ public static VarianceAggregatorCollector from(ByteBuffer buffer)
   }
 
   public static final Comparator<VarianceAggregatorCollector> COMPARATOR = (o1, o2) -> {
-    int compare = Longs.compare(o1.count, o2.count);
+    int compare = Doubles.compare(o1.nvariance, o2.nvariance);

Review comment:
       I think so. I based this on the comment against the `nvariance` variable
   
   ```
   double nvariance; // sum[x-avg^2] (this is actually n times of the variance)
   ```
   
   `getVariance(isVariancePop)` looks like it divides by the count to get variance instead of nvariance.




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