|
63 | 63 | import org.opensearch.common.util.BitMixer; |
64 | 64 | import org.opensearch.common.util.LongArray; |
65 | 65 | import org.opensearch.common.util.ObjectArray; |
66 | | -import org.opensearch.core.common.unit.ByteSizeUnit; |
67 | 66 | import org.opensearch.core.common.unit.ByteSizeValue; |
68 | 67 | import org.opensearch.core.rest.RestStatus; |
69 | 68 | import org.opensearch.index.fielddata.SortedBinaryDocValues; |
@@ -94,17 +93,23 @@ public class CardinalityAggregator extends NumericMetricsAggregator.SingleValue |
94 | 93 | /** |
95 | 94 | * Setting to enable/disable hybrid collector for cardinality aggregation. |
96 | 95 | */ |
97 | | - public static final Setting<Boolean> CARDINALITY_AGGREGATION_HYBRID_COLLECTOR_ENABLED = |
98 | | - Setting.boolSetting("search.aggregations.cardinality.hybrid_collector.enabled", true, |
99 | | - Setting.Property.NodeScope, Setting.Property.Dynamic); |
| 96 | + public static final Setting<Boolean> CARDINALITY_AGGREGATION_HYBRID_COLLECTOR_ENABLED = Setting.boolSetting( |
| 97 | + "search.aggregations.cardinality.hybrid_collector.enabled", |
| 98 | + true, |
| 99 | + Setting.Property.NodeScope, |
| 100 | + Setting.Property.Dynamic |
| 101 | + ); |
100 | 102 |
|
101 | 103 | /** |
102 | 104 | * Setting for hybrid collector memory threshold. Supports both percentage (e.g., "1%") |
103 | 105 | * and absolute values (e.g., "10mb", "1gb"). |
104 | 106 | */ |
105 | | - public static final Setting<ByteSizeValue> CARDINALITY_AGGREGATION_HYBRID_COLLECTOR_MEMORY_THRESHOLD = |
106 | | - Setting.memorySizeSetting("search.aggregations.cardinality.hybrid_collector.memory_threshold", |
107 | | - "1%", Setting.Property.NodeScope, Setting.Property.Dynamic); |
| 107 | + public static final Setting<ByteSizeValue> CARDINALITY_AGGREGATION_HYBRID_COLLECTOR_MEMORY_THRESHOLD = Setting.memorySizeSetting( |
| 108 | + "search.aggregations.cardinality.hybrid_collector.memory_threshold", |
| 109 | + "1%", |
| 110 | + Setting.Property.NodeScope, |
| 111 | + Setting.Property.Dynamic |
| 112 | + ); |
108 | 113 |
|
109 | 114 | final CardinalityAggregatorFactory.ExecutionMode executionMode; |
110 | 115 | final int precision; |
@@ -812,8 +817,13 @@ static class HybridCollector extends Collector { |
812 | 817 | private final OrdinalsCollector ordinalsCollector; |
813 | 818 | private boolean switchedToDirectCollector = false; |
814 | 819 |
|
815 | | - HybridCollector(HyperLogLogPlusPlus counts, SortedSetDocValues ordinalValues, |
816 | | - MurmurHash3Values hashValues, BigArrays bigArrays, long memoryThreshold) { |
| 820 | + HybridCollector( |
| 821 | + HyperLogLogPlusPlus counts, |
| 822 | + SortedSetDocValues ordinalValues, |
| 823 | + MurmurHash3Values hashValues, |
| 824 | + BigArrays bigArrays, |
| 825 | + long memoryThreshold |
| 826 | + ) { |
817 | 827 | this.counts = counts; |
818 | 828 | this.hashValues = hashValues; |
819 | 829 | this.memoryThreshold = memoryThreshold; |
|
0 commit comments