level23 / druid-client

Druid php client for executing queries and more
Other
28 stars 7 forks source link

Adding expression PostAggregator #54

Closed henris92 closed 12 months ago

henris92 commented 1 year ago

Hello guys,

Last week I needed more complex postAggregation operations so I integrated post aggregation by expression.

It works like this. We have somekind of operation like so:

// We want this post aggregation operation to be calculated by Druid, 
$operation = "((CAST(\"sys_unique_event_count\", 'DOUBLE') / \"sys_event_count\") * 100)";

$queryBuilder->expression("example_dim", $operation);
"postAggregations": [
        {
            "type": "expression",
            "name": "example_dim",
            "expression": "((CAST(\"sys_unique_event_count\", 'DOUBLE') / \"sys_event_count\") * 100)"
        }
    ],

Thank you! I really like your druid php lib

teyeheimans commented 12 months ago

Hi @henris92,

Thanks for your Pull Request. We have decided not to merge it based on several reasons:

However, we totally agree that this post aggregator was missing! We have created a new PR based on your changes, and added the missing parts. See https://github.com/level23/druid-client/pull/55

I want to thank you for your help. Feedback is always appreciated!

henris92 commented 12 months ago

Thank you guys! I'll update my project and test it out :)