setIntermediateCombineDegree()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 3
CRAP Score 1

Importance

Changes 0
Metric Value
eloc 2
dl 0
loc 5
ccs 3
cts 3
cp 1
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 1
crap 1
1
<?php
2
declare(strict_types=1);
3
4
namespace Level23\Druid\Context;
5
6
/**
7
 * GroupBy queries can be executed using two different strategies. The default strategy for a cluster is determined
8
 * by the "druid.query.groupBy.defaultStrategy" runtime property on the Broker. This can be overridden using
9
 * "groupByStrategy" in the query context.
10
 *
11
 * Overrides the value of druid.query.groupBy.defaultStrategy for this query.
12
 */
13
class GroupByQueryContext extends QueryContext implements ContextInterface
14
{
15
    /**
16
     * @param array<string,string|int|bool> $properties
17
     */
18 9
    public function __construct(array $properties = [])
19
    {
20 9
        $this->properties['groupByStrategy'] = 'v2';
21 9
        parent::__construct($properties);
22
    }
23
24
    /**
25
     * Overrides the value of druid.query.groupBy.singleThreaded for this query.
26
     *
27
     * @param bool $groupByIsSingleThreaded
28
     *
29
     * @return $this
30
     */
31 1
    public function setGroupByIsSingleThreaded(bool $groupByIsSingleThreaded): self
32
    {
33 1
        $this->properties['groupByIsSingleThreaded'] = $groupByIsSingleThreaded;
34
35 1
        return $this;
36
    }
37
38
    /**
39
     * Overrides the value of druid.query.groupBy.bufferGrouperInitialBuckets for this query.
40
     *
41
     * @param int $bufferGrouperInitialBuckets
42
     *
43
     * @return $this
44
     */
45 1
    public function setBufferGrouperInitialBuckets(int $bufferGrouperInitialBuckets): self
46
    {
47 1
        $this->properties['bufferGrouperInitialBuckets'] = $bufferGrouperInitialBuckets;
48
49 1
        return $this;
50
    }
51
52
    /**
53
     * Overrides the value of druid.query.groupBy.bufferGrouperMaxLoadFactor for this query.
54
     *
55
     * @param int $bufferGrouperMaxLoadFactor
56
     *
57
     * @return $this
58
     */
59 1
    public function setBufferGrouperMaxLoadFactor(int $bufferGrouperMaxLoadFactor): self
60
    {
61 1
        $this->properties['bufferGrouperMaxLoadFactor'] = $bufferGrouperMaxLoadFactor;
62
63 1
        return $this;
64
    }
65
66
    /**
67
     * Overrides the value of druid.query.groupBy.forceHashAggregation
68
     *
69
     * @param bool $forceHashAggregation
70
     *
71
     * @return $this
72
     */
73 1
    public function setForceHashAggregation(bool $forceHashAggregation): self
74
    {
75 1
        $this->properties['forceHashAggregation'] = $forceHashAggregation;
76
77 1
        return $this;
78
    }
79
80
    /**
81
     * Overrides the value of druid.query.groupBy.intermediateCombineDegree
82
     *
83
     * @param int $intermediateCombineDegree
84
     *
85
     * @return $this
86
     */
87 1
    public function setIntermediateCombineDegree(int $intermediateCombineDegree): self
88
    {
89 1
        $this->properties['intermediateCombineDegree'] = $intermediateCombineDegree;
90
91 1
        return $this;
92
    }
93
94
    /**
95
     * Overrides the value of druid.query.groupBy.numParallelCombineThreads
96
     *
97
     * @param int $numParallelCombineThreads
98
     *
99
     * @return $this
100
     */
101 1
    public function setNumParallelCombineThreads(int $numParallelCombineThreads): self
102
    {
103 1
        $this->properties['numParallelCombineThreads'] = $numParallelCombineThreads;
104
105 1
        return $this;
106
    }
107
108
    /**
109
     * Sort the results first by dimension values and then by timestamp.
110
     *
111
     * @param bool $sortByDimsFirst
112
     *
113
     * @return $this
114
     */
115 1
    public function setSortByDimsFirst(bool $sortByDimsFirst): self
116
    {
117 1
        $this->properties['sortByDimsFirst'] = $sortByDimsFirst;
118
119 1
        return $this;
120
    }
121
122
    /**
123
     * When all fields in the orderBy are part of the grouping key, the Broker will push limit application down to the
124
     * Historical processes. When the sorting order uses fields that are not in the grouping key, applying this
125
     * optimization can result in approximate results with unknown accuracy, so this optimization is disabled by
126
     * default in that case. Enabling this context flag turns on limit push down for limit/orderBy's that contain
127
     * non-grouping key columns.
128
     *
129
     * @param bool $forceLimitPushDown
130
     *
131
     * @return $this
132
     */
133 1
    public function setForceLimitPushDown(bool $forceLimitPushDown): self
134
    {
135 1
        $this->properties['forceLimitPushDown'] = $forceLimitPushDown;
136
137 1
        return $this;
138
    }
139
140
    /**
141
     * Can be used to lower the value of druid.query.groupBy.maxMergingDictionarySize for this query.
142
     *
143
     * @param int $maxMergingDictionarySize
144
     *
145
     * @return $this
146
     */
147 1
    public function setMaxMergingDictionarySize(int $maxMergingDictionarySize): self
148
    {
149 1
        $this->properties['maxMergingDictionarySize'] = $maxMergingDictionarySize;
150
151 1
        return $this;
152
    }
153
154
    /**
155
     * Can be used to lower the value of druid.query.groupBy.maxOnDiskStorage for this query.
156
     *
157
     * @param int $maxOnDiskStorage
158
     *
159
     * @return $this
160
     */
161 3
    public function setMaxOnDiskStorage(int $maxOnDiskStorage): self
162
    {
163 3
        $this->properties['maxOnDiskStorage'] = $maxOnDiskStorage;
164
165 3
        return $this;
166
    }
167
168
    /**
169
     * If Broker pushes limit down to queryable nodes (historicals, peons) then limit results
170
     * during segment scan. This context value can be used to override
171
     * druid.query.groupBy.applyLimitPushDownToSegment.
172
     *
173
     * @param bool $applyLimitPushDownToSegment
174
     *
175
     * @return $this
176
     */
177 1
    public function setApplyLimitPushDownToSegment(bool $applyLimitPushDownToSegment): self
178
    {
179 1
        $this->properties['applyLimitPushDownToSegment'] = $applyLimitPushDownToSegment;
180
181 1
        return $this;
182
    }
183
}