druid-io / pydruid

A Python connector for Druid
Other
506 stars 194 forks source link

Support QuantilesDoublesSketchToQuantile post_aggregator #247

Open qasimzee opened 3 years ago

qasimzee commented 3 years ago

I created QuantilesDoublesSketchToQuantile that's a performant post aggregator based on quantilesDoublesSketch:

class QuantilesDoublesSketchToQuantile(Postaggregator):
    def __init__(self, name: str, field_name: str, fraction: float):
        self.post_aggregator = {
            "type": "quantilesDoublesSketchToQuantile",
            "name": name,
            "fraction": fraction,
            "field": {"fieldName": field_name, "name": field_name, "type": "fieldAccess"},
        }

Please help if it's worth pushing it to pydruid

jaimee07 commented 2 years ago

@qasimzee is there a workaround to get the median/quantile without using this? I cant seem to do this with the current Pydruid version. Just trying my luck here. Thank you.

jaimee07 commented 2 years ago

@qasimzee Thanks for sharing your code. I was able to utilize this on our end. I created a PR for this: https://github.com/druid-io/pydruid/pull/287