How to use the pydruid.client.doublesum function in pydruid

To help you get started, we’ve selected a few pydruid examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github apache / incubator-superset / app.py View on Github external
filters = cond and filters
                else:
                    filters = cond
            else:
                break
            i += 1

        kw = {}
        if filters:
            kw['filter'] = filters
        query.groupby(
            datasource=ds.name,
            granularity=granularity or 'all',
            intervals=from_dttm + '/' + datetime.now().isoformat(),
            dimensions=groupby,
            aggregations={"count": client.doublesum(metric)},
            #filter=filters,
            limit_spec={
                "type": "default",
                "limit": limit,
                "columns": [{
                    "dimension" : metric,
                    "direction" : "descending",
                },],
            },
            **kw
        )
        return query.export_pandas()
github apache / incubator-superset / panoramix / views.py View on Github external
def autocomplete(self, datasource, column):
        client = utils.get_pydruid_client()
        top = client.topn(
            datasource=datasource,
            granularity='all',
            intervals='2013-10-04/2020-10-10',
            aggregations={"count": doublesum("count")},
            dimension=column,
            metric='count',
            threshold=1000,
        )
        values = sorted([d[column] for d in top[0]['result']])
        return json.dumps(values)