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 2019/05/21 19:41:30 UTC

[GitHub] [incubator-druid] himanshug commented on a change in pull request #7718: allow quantiles merge aggregator to also accept doubles

himanshug commented on a change in pull request #7718: allow quantiles merge aggregator to also accept doubles
URL: https://github.com/apache/incubator-druid/pull/7718#discussion_r286192541
 
 

 ##########
 File path: extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/quantiles/DoublesSketchMergeBufferAggregator.java
 ##########
 @@ -62,12 +62,16 @@ public synchronized void init(final ByteBuffer buffer, final int position)
   @Override
   public synchronized void aggregate(final ByteBuffer buffer, final int position)
   {
-    final DoublesSketch sketch = selector.getObject();
-    if (sketch == null) {
+    final Object object = selector.getObject();
+    if (object == null) {
       return;
     }
     final DoublesUnion union = unions.get(buffer).get(position);
-    union.update(sketch);
+    if (object instanceof DoublesSketch) {
+      union.update((DoublesSketch) object);
+    } else {
+      union.update(selector.getDouble());
+    }
 
 Review comment:
   nit: would be nice to extract last 5 lines in either of the aggregator classes.

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


With regards,
Apache Git Services

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