diff --git a/pydruid/utils/aggregators.py b/pydruid/utils/aggregators.py index 23caa826..93b243ed 100644 --- a/pydruid/utils/aggregators.py +++ b/pydruid/utils/aggregators.py @@ -16,12 +16,13 @@ from .filters import Filter -def thetasketch(raw_column, isinputthetasketch=False, size=16384): +def thetasketch(raw_column, isinputthetasketch=False, size=16384, should_finalize=True): return { "type": "thetaSketch", "fieldName": raw_column, "isInputThetaSketch": isinputthetasketch, "size": size, + "shouldFinalize": should_finalize, } diff --git a/tests/utils/test_aggregators.py b/tests/utils/test_aggregators.py index aa5e7125..e8e4b155 100644 --- a/tests/utils/test_aggregators.py +++ b/tests/utils/test_aggregators.py @@ -88,7 +88,7 @@ def test_build_aggregators(self): "agg9": aggregators.thetasketch("dim1"), "agg10": aggregators.thetasketch("metric7"), "agg11": aggregators.thetasketch( - "metric8", isinputthetasketch=True, size=8192 + "metric8", isinputthetasketch=True, size=8192, should_finalize=False ), } built_agg = aggregators.build_aggregators(agg_input) @@ -116,6 +116,7 @@ def test_build_aggregators(self): "type": "thetaSketch", "fieldName": "dim1", "isInputThetaSketch": False, + "shouldFinalize": True, "size": 16384, }, { @@ -123,6 +124,7 @@ def test_build_aggregators(self): "type": "thetaSketch", "fieldName": "metric7", "isInputThetaSketch": False, + "shouldFinalize": True, "size": 16384, }, { @@ -130,6 +132,7 @@ def test_build_aggregators(self): "type": "thetaSketch", "fieldName": "metric8", "isInputThetaSketch": True, + "shouldFinalize": False, "size": 8192, }, ] @@ -186,6 +189,7 @@ def test_build_filtered_aggregator(self): "type": "thetaSketch", "fieldName": "dim1", "isInputThetaSketch": False, + "shouldFinalize": True, "size": 16384, }, { @@ -193,6 +197,7 @@ def test_build_filtered_aggregator(self): "type": "thetaSketch", "fieldName": "metric7", "isInputThetaSketch": False, + "shouldFinalize": True, "size": 16384, }, { @@ -200,6 +205,7 @@ def test_build_filtered_aggregator(self): "type": "thetaSketch", "fieldName": "metric8", "isInputThetaSketch": True, + "shouldFinalize": True, "size": 8192, }, ]