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/09/11 09:59:30 UTC

[GitHub] [incubator-druid] Foxterran opened a new issue #8504: HLLSketchEstimateWithBounds can't be applied to Arithmetric post aggregator

Foxterran opened a new issue #8504: HLLSketchEstimateWithBounds can't be applied to Arithmetric post aggregator
URL: https://github.com/apache/incubator-druid/issues/8504
 
 
   HLLSketchEstimateWithBounds can't be used as a numeric value in arithmetric post aggregator, because it's returning an array [estimate value, upper bounds, lower bounds]
   ### Affected Version
   
   0.14.2
   
   ### Description
   
   I have two HLLSketch metrics called unique_click_visitors and unique_view_visitors, it's built with "HLLSketchBuild" module during ingestion time, it's doing well via aggregator module, however, I need to calculate the ratio of the metrics, i.e. unique_click_visitors / unique_view_visitors to get the click through rate.
   
   Per this doc https://druid.apache.org/docs/latest/development/extensions-core/datasketches-hll.html , I started to use HLLSketchEstimateWithBounds  rounded with arithmetic post aggregator, the query spec (only postAggregations part) is as below:
   
   `"postAggregations": [
       {
         "type": "arithmetic",
         "name": "click_through_rate",
         "fn": "/",
         "fields": [
           {
             "type": "HLLSketchEstimateWithBounds",
             "name": "unique_click_visitors ",
             "field": {
               "type": "fieldAccess",
               "name": "unique_click_visitors ",
               "fieldName": "unique_click_visitors "
             }
           },
           {
             "type": "HLLSketchEstimateWithBounds",
             "name": "unique_view_visitors ",
             "field": {
               "type": "fieldAccess",
               "name": "unique_view_visitors ",
               "fieldName": "unique_view_visitors "
             }
           }
         ]
       }
     ]`
   
   However, it kept showing exception:
   `{
     "error": "Unknown exception",
     "errorMessage": "[D cannot be cast to java.lang.Number",
     "errorClass": "java.lang.ClassCastException",
     "host": null
   }`
   
   I looked at the source code,  https://github.com/apache/incubator-druid/blob/master/extensions-core/datasketches/src/main/java/org/apache/druid/query/aggregation/datasketches/hll/HllSketchToEstimateWithBoundsPostAggregator.java
   
   looks like this estimator is not only return the estimate value, but also its upper bound and lower bound, packaging the result as an array.
   
   I can bypass this error by doing the post aggregation in application layer, although.
   But anyone else suffering this issue? 
   Please help to share your way out here? 
   
   Thank YOU!

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