@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | public function __construct( |
102 | 102 | DruidClient $client, |
103 | 103 | string $dataSource = '', |
104 | - string|Granularity $granularity = Granularity::ALL |
|
104 | + string | Granularity $granularity = Granularity::ALL |
|
105 | 105 | ) { |
106 | 106 | $this->client = $client; |
107 | 107 | $this->query = $this; |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * @return $this |
125 | 125 | * @see https://druid.apache.org/docs/latest/misc/math-expr.html |
126 | 126 | */ |
127 | - public function selectVirtual(string $expression, string $as, string|DataType $outputType = DataType::STRING): self |
|
127 | + public function selectVirtual(string $expression, string $as, string | DataType $outputType = DataType::STRING): self |
|
128 | 128 | { |
129 | 129 | $this->virtualColumn($expression, $as, $outputType); |
130 | 130 | $this->select($as, $as, $outputType); |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
142 | 142 | * @throws \GuzzleHttp\Exception\GuzzleException |
143 | 143 | */ |
144 | - public function execute(array|QueryContext $context = []): QueryResponse |
|
144 | + public function execute(array | QueryContext $context = []): QueryResponse |
|
145 | 145 | { |
146 | 146 | $query = $this->getQuery($context); |
147 | 147 | |
@@ -157,7 +157,7 @@ discard block |
||
157 | 157 | * |
158 | 158 | * @return $this |
159 | 159 | */ |
160 | - public function granularity(string|Granularity $granularity): QueryBuilder |
|
160 | + public function granularity(string | Granularity $granularity): QueryBuilder |
|
161 | 161 | { |
162 | 162 | $this->granularity = is_string($granularity) ? Granularity::from(strtolower($granularity)) : $granularity; |
163 | 163 | |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | * @return string |
249 | 249 | * @throws \InvalidArgumentException if the JSON cannot be encoded. |
250 | 250 | */ |
251 | - public function toJson(array|QueryContext $context = []): string |
|
251 | + public function toJson(array | QueryContext $context = []): string |
|
252 | 252 | { |
253 | 253 | $query = $this->getQuery($context); |
254 | 254 | |
@@ -262,7 +262,7 @@ discard block |
||
262 | 262 | * |
263 | 263 | * @return array<string,array<mixed>|string|int> |
264 | 264 | */ |
265 | - public function toArray(array|QueryContext $context = []): array |
|
265 | + public function toArray(array | QueryContext $context = []): array |
|
266 | 266 | { |
267 | 267 | return $this->getQuery($context)->toArray(); |
268 | 268 | } |
@@ -276,7 +276,7 @@ discard block |
||
276 | 276 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
277 | 277 | * @throws \GuzzleHttp\Exception\GuzzleException |
278 | 278 | */ |
279 | - public function timeseries(array|TimeSeriesQueryContext $context = []): TimeSeriesQueryResponse |
|
279 | + public function timeseries(array | TimeSeriesQueryContext $context = []): TimeSeriesQueryResponse |
|
280 | 280 | { |
281 | 281 | $query = $this->buildTimeSeriesQuery($context); |
282 | 282 | |
@@ -305,10 +305,10 @@ discard block |
||
305 | 305 | * @throws \GuzzleHttp\Exception\GuzzleException |
306 | 306 | */ |
307 | 307 | public function scan( |
308 | - array|ScanQueryContext $context = [], |
|
308 | + array | ScanQueryContext $context = [], |
|
309 | 309 | ?int $rowBatchSize = null, |
310 | 310 | bool $legacy = false, |
311 | - string|ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
311 | + string | ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
312 | 312 | ): ScanQueryResponse { |
313 | 313 | $query = $this->buildScanQuery($context, $rowBatchSize, $legacy, $resultFormat); |
314 | 314 | |
@@ -326,7 +326,7 @@ discard block |
||
326 | 326 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
327 | 327 | * @throws \GuzzleHttp\Exception\GuzzleException |
328 | 328 | */ |
329 | - public function selectQuery(array|QueryContext $context = []): SelectQueryResponse |
|
329 | + public function selectQuery(array | QueryContext $context = []): SelectQueryResponse |
|
330 | 330 | { |
331 | 331 | $query = $this->buildSelectQuery($context); |
332 | 332 | |
@@ -344,7 +344,7 @@ discard block |
||
344 | 344 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
345 | 345 | * @throws \GuzzleHttp\Exception\GuzzleException |
346 | 346 | */ |
347 | - public function topN(array|TopNQueryContext $context = []): TopNQueryResponse |
|
347 | + public function topN(array | TopNQueryContext $context = []): TopNQueryResponse |
|
348 | 348 | { |
349 | 349 | $query = $this->buildTopNQuery($context); |
350 | 350 | |
@@ -362,7 +362,7 @@ discard block |
||
362 | 362 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
363 | 363 | * @throws \GuzzleHttp\Exception\GuzzleException |
364 | 364 | */ |
365 | - public function groupBy(array|GroupByQueryContext $context = []): GroupByQueryResponse |
|
365 | + public function groupBy(array | GroupByQueryContext $context = []): GroupByQueryResponse |
|
366 | 366 | { |
367 | 367 | $query = $this->buildGroupByQuery($context); |
368 | 368 | |
@@ -382,8 +382,8 @@ discard block |
||
382 | 382 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
383 | 383 | */ |
384 | 384 | public function search( |
385 | - array|QueryContext $context = [], |
|
386 | - string|SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
385 | + array | QueryContext $context = [], |
|
386 | + string | SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
387 | 387 | ): SearchQueryResponse { |
388 | 388 | $query = $this->buildSearchQuery($context, $sortingOrder); |
389 | 389 | |
@@ -438,8 +438,8 @@ discard block |
||
438 | 438 | * @return \Level23\Druid\Queries\SearchQuery |
439 | 439 | */ |
440 | 440 | protected function buildSearchQuery( |
441 | - array|QueryContext $context = [], |
|
442 | - string|SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
441 | + array | QueryContext $context = [], |
|
442 | + string | SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
443 | 443 | ): SearchQuery { |
444 | 444 | if (count($this->intervals) == 0) { |
445 | 445 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -488,7 +488,7 @@ discard block |
||
488 | 488 | * |
489 | 489 | * @return \Level23\Druid\Queries\SelectQuery |
490 | 490 | */ |
491 | - protected function buildSelectQuery(array|QueryContext $context = []): SelectQuery |
|
491 | + protected function buildSelectQuery(array | QueryContext $context = []): SelectQuery |
|
492 | 492 | { |
493 | 493 | if (count($this->intervals) == 0) { |
494 | 494 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -540,10 +540,10 @@ discard block |
||
540 | 540 | * @return \Level23\Druid\Queries\ScanQuery |
541 | 541 | */ |
542 | 542 | protected function buildScanQuery( |
543 | - array|QueryContext $context = [], |
|
543 | + array | QueryContext $context = [], |
|
544 | 544 | ?int $rowBatchSize = null, |
545 | 545 | bool $legacy = false, |
546 | - string|ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
546 | + string | ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
547 | 547 | ): ScanQuery { |
548 | 548 | if (count($this->intervals) == 0) { |
549 | 549 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -621,7 +621,7 @@ discard block |
||
621 | 621 | * |
622 | 622 | * @return TimeSeriesQuery |
623 | 623 | */ |
624 | - protected function buildTimeSeriesQuery(array|QueryContext $context = []): TimeSeriesQuery |
|
624 | + protected function buildTimeSeriesQuery(array | QueryContext $context = []): TimeSeriesQuery |
|
625 | 625 | { |
626 | 626 | if (count($this->intervals) == 0) { |
627 | 627 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -689,7 +689,7 @@ discard block |
||
689 | 689 | * |
690 | 690 | * @return TopNQuery |
691 | 691 | */ |
692 | - protected function buildTopNQuery(array|QueryContext $context = []): TopNQuery |
|
692 | + protected function buildTopNQuery(array | QueryContext $context = []): TopNQuery |
|
693 | 693 | { |
694 | 694 | if (count($this->intervals) == 0) { |
695 | 695 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | * |
762 | 762 | * @return GroupByQuery |
763 | 763 | */ |
764 | - protected function buildGroupByQuery(array|QueryContext $context = []): GroupByQuery |
|
764 | + protected function buildGroupByQuery(array | QueryContext $context = []): GroupByQuery |
|
765 | 765 | { |
766 | 766 | if (count($this->intervals) == 0) { |
767 | 767 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -815,7 +815,7 @@ discard block |
||
815 | 815 | * |
816 | 816 | * @return \Level23\Druid\Queries\QueryInterface |
817 | 817 | */ |
818 | - public function getQuery(array|QueryContext $context = []): QueryInterface |
|
818 | + public function getQuery(array | QueryContext $context = []): QueryInterface |
|
819 | 819 | { |
820 | 820 | // Check if this is a scan query. This is the preferred way to query when there are |
821 | 821 | // no aggregations done. |
@@ -24,12 +24,12 @@ discard block |
||
24 | 24 | public function __construct( |
25 | 25 | string $dimension, |
26 | 26 | string $outputName = null, |
27 | - string|DataType $outputType = DataType::STRING |
|
27 | + string | DataType $outputType = DataType::STRING |
|
28 | 28 | ) { |
29 | 29 | $this->dimension = $dimension; |
30 | 30 | $this->outputName = $outputName ?: $dimension; |
31 | 31 | |
32 | - if( empty($outputType)) { |
|
32 | + if (empty($outputType)) { |
|
33 | 33 | $outputType = DataType::STRING; |
34 | 34 | } else { |
35 | 35 | $outputType = is_string($outputType) ? DataType::from(strtolower($outputType)) : $outputType; |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | ); |
42 | 42 | } |
43 | 43 | |
44 | - $this->outputType = $outputType; |
|
44 | + $this->outputType = $outputType; |
|
45 | 45 | } |
46 | 46 | |
47 | 47 | /** |
@@ -60,9 +60,9 @@ discard block |
||
60 | 60 | * @return $this |
61 | 61 | */ |
62 | 62 | public function where( |
63 | - Closure|string|FilterInterface $filterOrDimensionOrClosure, |
|
64 | - int|string|float|bool|null $operator = null, |
|
65 | - array|int|string|float|bool $value = null, |
|
63 | + Closure | string | FilterInterface $filterOrDimensionOrClosure, |
|
64 | + int | string | float | bool | null $operator = null, |
|
65 | + array | int | string | float | bool $value = null, |
|
66 | 66 | string $boolean = 'and' |
67 | 67 | ): self { |
68 | 68 | |
@@ -243,7 +243,7 @@ discard block |
||
243 | 243 | * @see https://druid.apache.org/docs/latest/querying/filters/#array-contains-element-filter |
244 | 244 | * |
245 | 245 | */ |
246 | - public function whereArrayContains(string $column, int|float|string|null $value, string $boolean = 'and'): self |
|
246 | + public function whereArrayContains(string $column, int | float | string | null $value, string $boolean = 'and'): self |
|
247 | 247 | { |
248 | 248 | $filter = new ArrayContainsFilter($column, $value); |
249 | 249 | |
@@ -259,7 +259,7 @@ discard block |
||
259 | 259 | * |
260 | 260 | * @return $this |
261 | 261 | */ |
262 | - public function orWhereArrayContains(string $column, int|float|string|null $value): self |
|
262 | + public function orWhereArrayContains(string $column, int | float | string | null $value): self |
|
263 | 263 | { |
264 | 264 | return $this->whereArrayContains($column, $value, 'or'); |
265 | 265 | } |
@@ -315,9 +315,9 @@ discard block |
||
315 | 315 | * @see \Level23\Druid\Concerns\HasFilter::where() |
316 | 316 | */ |
317 | 317 | public function orWhere( |
318 | - string|FilterInterface $filterOrDimension, |
|
319 | - string|int|float|bool $operator = null, |
|
320 | - array|int|float|string|bool $value = null |
|
318 | + string | FilterInterface $filterOrDimension, |
|
319 | + string | int | float | bool $operator = null, |
|
320 | + array | int | float | string | bool $value = null |
|
321 | 321 | ): self { |
322 | 322 | return $this->where($filterOrDimension, $operator, $value, 'or'); |
323 | 323 | } |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @return $this |
441 | 441 | */ |
442 | - public function whereColumn(Closure|string $dimensionA, Closure|string $dimensionB, string $boolean = 'and'): self |
|
442 | + public function whereColumn(Closure | string $dimensionA, Closure | string $dimensionB, string $boolean = 'and'): self |
|
443 | 443 | { |
444 | 444 | $filter = new ColumnComparisonFilter( |
445 | 445 | $this->columnCompareDimension($dimensionA), |
@@ -468,7 +468,7 @@ discard block |
||
468 | 468 | * |
469 | 469 | * @return $this |
470 | 470 | */ |
471 | - public function orWhereColumn(Closure|string $dimensionA, Closure|string $dimensionB): self |
|
471 | + public function orWhereColumn(Closure | string $dimensionA, Closure | string $dimensionB): self |
|
472 | 472 | { |
473 | 473 | return $this->whereColumn($dimensionA, $dimensionB, 'or'); |
474 | 474 | } |
@@ -499,8 +499,8 @@ discard block |
||
499 | 499 | */ |
500 | 500 | public function whereBetween( |
501 | 501 | string $dimension, |
502 | - int|float|string $minValue, |
|
503 | - int|float|string $maxValue, |
|
502 | + int | float | string $minValue, |
|
503 | + int | float | string $maxValue, |
|
504 | 504 | ?DataType $valueType = null, |
505 | 505 | string $boolean = 'and' |
506 | 506 | ): self { |
@@ -534,8 +534,8 @@ discard block |
||
534 | 534 | */ |
535 | 535 | public function orWhereBetween( |
536 | 536 | string $dimension, |
537 | - int|float|string $minValue, |
|
538 | - int|float|string $maxValue, |
|
537 | + int | float | string $minValue, |
|
538 | + int | float | string $maxValue, |
|
539 | 539 | ?DataType $valueType = null |
540 | 540 | ): self { |
541 | 541 | return $this->whereBetween($dimension, $minValue, $maxValue, $valueType, 'or'); |
@@ -785,7 +785,7 @@ discard block |
||
785 | 785 | * @return \Level23\Druid\Dimensions\DimensionInterface |
786 | 786 | * @throws InvalidArgumentException |
787 | 787 | */ |
788 | - protected function columnCompareDimension(Closure|string $dimension): DimensionInterface |
|
788 | + protected function columnCompareDimension(Closure | string $dimension): DimensionInterface |
|
789 | 789 | { |
790 | 790 | if ($dimension instanceof Closure) { |
791 | 791 | $builder = new DimensionBuilder(); |
@@ -47,9 +47,9 @@ discard block |
||
47 | 47 | * @return self |
48 | 48 | */ |
49 | 49 | public function select( |
50 | - array|ArrayObject|string|DimensionInterface $dimension, |
|
50 | + array | ArrayObject | string | DimensionInterface $dimension, |
|
51 | 51 | string $as = '', |
52 | - string|DataType $outputType = DataType::STRING |
|
52 | + string | DataType $outputType = DataType::STRING |
|
53 | 53 | ): self { |
54 | 54 | if (is_string($dimension)) { |
55 | 55 | $this->addDimension(new Dimension( |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | string $lookupFunction, |
83 | 83 | string $dimension, |
84 | 84 | string $as = '', |
85 | - bool|string $keepMissingValue = false |
|
85 | + bool | string $keepMissingValue = false |
|
86 | 86 | ): self { |
87 | 87 | $this->addDimension(new LookupDimension( |
88 | 88 | $dimension, |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | array $map, |
117 | 117 | string $dimension, |
118 | 118 | string $as = '', |
119 | - bool|string $keepMissingValue = false, |
|
119 | + bool | string $keepMissingValue = false, |
|
120 | 120 | bool $isOneToOne = false |
121 | 121 | ): self { |
122 | 122 | $this->addDimension(new LookupDimension( |
@@ -149,7 +149,7 @@ discard block |
||
149 | 149 | string $dimension, |
150 | 150 | array $values, |
151 | 151 | string $as = '', |
152 | - string|DataType $outputType = DataType::STRING, |
|
152 | + string | DataType $outputType = DataType::STRING, |
|
153 | 153 | bool $isWhitelist = true |
154 | 154 | ): self { |
155 | 155 | $this->addDimension(new ListFilteredDimension( |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | string $dimension, |
185 | 185 | string $regex, |
186 | 186 | string $as = '', |
187 | - string|DataType $outputType = DataType::STRING |
|
187 | + string | DataType $outputType = DataType::STRING |
|
188 | 188 | ): self { |
189 | 189 | $this->addDimension(new RegexFilteredDimension( |
190 | 190 | new Dimension( |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | string $dimension, |
216 | 216 | string $prefix, |
217 | 217 | string $as = '', |
218 | - string|DataType $outputType = DataType::STRING |
|
218 | + string | DataType $outputType = DataType::STRING |
|
219 | 219 | ): self { |
220 | 220 | $this->addDimension(new PrefixFilteredDimension( |
221 | 221 | new Dimension( |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | * |
235 | 235 | * @param ArrayObject<int|string,string>|string|DimensionInterface|array<int,string> $dimension |
236 | 236 | */ |
237 | - protected function addDimension(array|ArrayObject|string|DimensionInterface $dimension): void |
|
237 | + protected function addDimension(array | ArrayObject | string | DimensionInterface $dimension): void |
|
238 | 238 | { |
239 | 239 | if ($dimension instanceof DimensionInterface) { |
240 | 240 | $this->dimensions[] = $dimension; |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | |
23 | 23 | protected BoundOperator $operator; |
24 | 24 | |
25 | - protected string|int|float $value; |
|
25 | + protected string | int | float $value; |
|
26 | 26 | |
27 | 27 | protected SortingOrder $ordering; |
28 | 28 | |
@@ -44,8 +44,8 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct( |
46 | 46 | string $column, |
47 | - string|BoundOperator $operator, |
|
48 | - string|int|float $value, |
|
47 | + string | BoundOperator $operator, |
|
48 | + string | int | float $value, |
|
49 | 49 | DataType $valueType = null |
50 | 50 | ) { |
51 | 51 | $this->column = $column; |
@@ -22,9 +22,9 @@ discard block |
||
22 | 22 | { |
23 | 23 | protected string $column; |
24 | 24 | |
25 | - protected int|string|float $minValue; |
|
25 | + protected int | string | float $minValue; |
|
26 | 26 | |
27 | - protected int|string|float $maxValue; |
|
27 | + protected int | string | float $maxValue; |
|
28 | 28 | |
29 | 29 | protected DataType $valueType; |
30 | 30 | |
@@ -41,8 +41,8 @@ discard block |
||
41 | 41 | */ |
42 | 42 | public function __construct( |
43 | 43 | string $column, |
44 | - int|float|string $minValue, |
|
45 | - int|float|string $maxValue, |
|
44 | + int | float | string $minValue, |
|
45 | + int | float | string $maxValue, |
|
46 | 46 | DataType $valueType = null |
47 | 47 | ) { |
48 | 48 | if (is_null($valueType)) { |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | protected string $column; |
11 | 11 | |
12 | - protected string|int|float $value; |
|
12 | + protected string | int | float $value; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @var \Level23\Druid\Types\DataType |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct( |
28 | 28 | string $column, |
29 | - string|int|float $value, |
|
29 | + string | int | float $value, |
|
30 | 30 | DataType $matchValueType = null |
31 | 31 | ) { |
32 | 32 | if (is_null($matchValueType)) { |
@@ -9,7 +9,7 @@ discard block |
||
9 | 9 | { |
10 | 10 | protected string $column; |
11 | 11 | |
12 | - protected string|int|float|null $value; |
|
12 | + protected string | int | float | null $value; |
|
13 | 13 | |
14 | 14 | /** |
15 | 15 | * @var \Level23\Druid\Types\DataType |
@@ -26,7 +26,7 @@ discard block |
||
26 | 26 | */ |
27 | 27 | public function __construct( |
28 | 28 | string $column, |
29 | - string|int|float|null $value, |
|
29 | + string | int | float | null $value, |
|
30 | 30 | DataType $matchValueType = null |
31 | 31 | ) { |
32 | 32 | if (is_null($matchValueType)) { |
@@ -37,11 +37,11 @@ |
||
37 | 37 | */ |
38 | 38 | public function __construct( |
39 | 39 | string $dimension, |
40 | - string|BoundOperator $operator, |
|
40 | + string | BoundOperator $operator, |
|
41 | 41 | string $value, |
42 | - string|SortingOrder $ordering = null |
|
42 | + string | SortingOrder $ordering = null |
|
43 | 43 | ) { |
44 | - if(is_string($ordering)) { |
|
44 | + if (is_string($ordering)) { |
|
45 | 45 | $ordering = SortingOrder::from(strtolower($ordering)); |
46 | 46 | } |
47 | 47 |