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


With regards,
Apache Git Services

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

Reply via email to