|
37 | 37 | from pydruid.client import PyDruid
|
38 | 38 | from pydruid.utils.aggregators import count
|
39 | 39 | from pydruid.utils.filters import Dimension, Filter
|
40 |
| -from pydruid.utils.postaggregator import Postaggregator |
| 40 | +from pydruid.utils.postaggregator import ( |
| 41 | + Postaggregator, Quantile, Quantiles, Field, Const, HyperUniqueCardinality, |
| 42 | +) |
41 | 43 | from pydruid.utils.having import Aggregation
|
42 | 44 | from six import string_types
|
43 | 45 |
|
@@ -2354,9 +2356,30 @@ def recursive_get_fields(_conf):
|
2354 | 2356 | all_metrics += conf.get('fieldNames', [])
|
2355 | 2357 | if conf.get('type') == 'javascript':
|
2356 | 2358 | post_aggs[metric_name] = JavascriptPostAggregator(
|
2357 |
| - name=conf.get('name'), |
2358 |
| - field_names=conf.get('fieldNames'), |
2359 |
| - function=conf.get('function')) |
| 2359 | + name=conf.get('name', ''), |
| 2360 | + field_names=conf.get('fieldNames', []), |
| 2361 | + function=conf.get('function', '')) |
| 2362 | + elif conf.get('type') == 'quantile': |
| 2363 | + post_aggs[metric_name] = Quantile( |
| 2364 | + conf.get('name', ''), |
| 2365 | + conf.get('probability', ''), |
| 2366 | + ) |
| 2367 | + elif conf.get('type') == 'quantiles': |
| 2368 | + post_aggs[metric_name] = Quantiles( |
| 2369 | + conf.get('name', ''), |
| 2370 | + conf.get('probabilities', ''), |
| 2371 | + ) |
| 2372 | + elif conf.get('type') == 'fieldAccess': |
| 2373 | + post_aggs[metric_name] = Field(conf.get('name'), '') |
| 2374 | + elif conf.get('type') == 'constant': |
| 2375 | + post_aggs[metric_name] = Const( |
| 2376 | + conf.get('value'), |
| 2377 | + output_name=conf.get('name', '') |
| 2378 | + ) |
| 2379 | + elif conf.get('type') == 'hyperUniqueCardinality': |
| 2380 | + post_aggs[metric_name] = HyperUniqueCardinality( |
| 2381 | + conf.get('name'), '' |
| 2382 | + ) |
2360 | 2383 | else:
|
2361 | 2384 | post_aggs[metric_name] = Postaggregator(
|
2362 | 2385 | conf.get('fn', "/"),
|
|
0 commit comments