@@ -23,7 +23,7 @@ |
||
23 | 23 | public function __construct( |
24 | 24 | string $metricName, |
25 | 25 | string $outputName = '', |
26 | - string|DataType $type = DataType::LONG, |
|
26 | + string | DataType $type = DataType::LONG, |
|
27 | 27 | int $maxStringBytes = null |
28 | 28 | ) { |
29 | 29 | if (is_string($type)) { |
@@ -15,7 +15,7 @@ |
||
15 | 15 | * @param string|DataType $type The type of field. This can either be "long", "float", "double" or "string" |
16 | 16 | * |
17 | 17 | */ |
18 | - public function __construct(string $metricName, string $outputName = '', string|DataType $type = DataType::LONG) |
|
18 | + public function __construct(string $metricName, string $outputName = '', string | DataType $type = DataType::LONG) |
|
19 | 19 | { |
20 | 20 | $this->type = is_string($type) ? DataType::from(strtolower($type)) : $type; |
21 | 21 | $this->metricName = $metricName; |
@@ -102,7 +102,7 @@ discard block |
||
102 | 102 | public function __construct( |
103 | 103 | DruidClient $client, |
104 | 104 | string $dataSource = '', |
105 | - string|Granularity $granularity = Granularity::ALL |
|
105 | + string | Granularity $granularity = Granularity::ALL |
|
106 | 106 | ) { |
107 | 107 | $this->client = $client; |
108 | 108 | $this->query = $this; |
@@ -125,7 +125,7 @@ discard block |
||
125 | 125 | * @return $this |
126 | 126 | * @see https://druid.apache.org/docs/latest/misc/math-expr.html |
127 | 127 | */ |
128 | - public function selectVirtual(string $expression, string $as, string|DataType $outputType = DataType::STRING): self |
|
128 | + public function selectVirtual(string $expression, string $as, string | DataType $outputType = DataType::STRING): self |
|
129 | 129 | { |
130 | 130 | $this->virtualColumn($expression, $as, $outputType); |
131 | 131 | $this->select($as, $as, null, $outputType); |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
143 | 143 | * @throws \GuzzleHttp\Exception\GuzzleException |
144 | 144 | */ |
145 | - public function execute(array|QueryContext $context = []): QueryResponse |
|
145 | + public function execute(array | QueryContext $context = []): QueryResponse |
|
146 | 146 | { |
147 | 147 | $query = $this->getQuery($context); |
148 | 148 | |
@@ -158,7 +158,7 @@ discard block |
||
158 | 158 | * |
159 | 159 | * @return $this |
160 | 160 | */ |
161 | - public function granularity(string|Granularity $granularity): QueryBuilder |
|
161 | + public function granularity(string | Granularity $granularity): QueryBuilder |
|
162 | 162 | { |
163 | 163 | $this->granularity = is_string($granularity) ? Granularity::from(strtolower($granularity)) : $granularity; |
164 | 164 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @return string |
250 | 250 | * @throws \InvalidArgumentException if the JSON cannot be encoded. |
251 | 251 | */ |
252 | - public function toJson(array|QueryContext $context = []): string |
|
252 | + public function toJson(array | QueryContext $context = []): string |
|
253 | 253 | { |
254 | 254 | $query = $this->getQuery($context); |
255 | 255 | |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | * |
264 | 264 | * @return array<string,array<mixed>|string|int> |
265 | 265 | */ |
266 | - public function toArray(array|QueryContext $context = []): array |
|
266 | + public function toArray(array | QueryContext $context = []): array |
|
267 | 267 | { |
268 | 268 | return $this->getQuery($context)->toArray(); |
269 | 269 | } |
@@ -277,7 +277,7 @@ discard block |
||
277 | 277 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
278 | 278 | * @throws \GuzzleHttp\Exception\GuzzleException |
279 | 279 | */ |
280 | - public function timeseries(array|TimeSeriesQueryContext $context = []): TimeSeriesQueryResponse |
|
280 | + public function timeseries(array | TimeSeriesQueryContext $context = []): TimeSeriesQueryResponse |
|
281 | 281 | { |
282 | 282 | $query = $this->buildTimeSeriesQuery($context); |
283 | 283 | |
@@ -306,10 +306,10 @@ discard block |
||
306 | 306 | * @throws \GuzzleHttp\Exception\GuzzleException |
307 | 307 | */ |
308 | 308 | public function scan( |
309 | - array|ScanQueryContext $context = [], |
|
309 | + array | ScanQueryContext $context = [], |
|
310 | 310 | ?int $rowBatchSize = null, |
311 | 311 | bool $legacy = false, |
312 | - string|ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
312 | + string | ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
313 | 313 | ): ScanQueryResponse { |
314 | 314 | $query = $this->buildScanQuery($context, $rowBatchSize, $legacy, $resultFormat); |
315 | 315 | |
@@ -327,7 +327,7 @@ discard block |
||
327 | 327 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
328 | 328 | * @throws \GuzzleHttp\Exception\GuzzleException |
329 | 329 | */ |
330 | - public function selectQuery(array|QueryContext $context = []): SelectQueryResponse |
|
330 | + public function selectQuery(array | QueryContext $context = []): SelectQueryResponse |
|
331 | 331 | { |
332 | 332 | $query = $this->buildSelectQuery($context); |
333 | 333 | |
@@ -345,7 +345,7 @@ discard block |
||
345 | 345 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
346 | 346 | * @throws \GuzzleHttp\Exception\GuzzleException |
347 | 347 | */ |
348 | - public function topN(array|TopNQueryContext $context = []): TopNQueryResponse |
|
348 | + public function topN(array | TopNQueryContext $context = []): TopNQueryResponse |
|
349 | 349 | { |
350 | 350 | $query = $this->buildTopNQuery($context); |
351 | 351 | |
@@ -363,7 +363,7 @@ discard block |
||
363 | 363 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
364 | 364 | * @throws \GuzzleHttp\Exception\GuzzleException |
365 | 365 | */ |
366 | - public function groupBy(array|GroupByV1QueryContext|GroupByV2QueryContext $context = []): GroupByQueryResponse |
|
366 | + public function groupBy(array | GroupByV1QueryContext | GroupByV2QueryContext $context = []): GroupByQueryResponse |
|
367 | 367 | { |
368 | 368 | $query = $this->buildGroupByQuery($context); |
369 | 369 | |
@@ -381,7 +381,7 @@ discard block |
||
381 | 381 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
382 | 382 | * @throws \GuzzleHttp\Exception\GuzzleException |
383 | 383 | */ |
384 | - public function groupByV1(array|GroupByV1QueryContext|GroupByV2QueryContext $context = []): GroupByQueryResponse |
|
384 | + public function groupByV1(array | GroupByV1QueryContext | GroupByV2QueryContext $context = []): GroupByQueryResponse |
|
385 | 385 | { |
386 | 386 | $query = $this->buildGroupByQuery($context, 'v1'); |
387 | 387 | |
@@ -401,8 +401,8 @@ discard block |
||
401 | 401 | * @throws \Level23\Druid\Exceptions\QueryResponseException |
402 | 402 | */ |
403 | 403 | public function search( |
404 | - array|QueryContext $context = [], |
|
405 | - string|SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
404 | + array | QueryContext $context = [], |
|
405 | + string | SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
406 | 406 | ): SearchQueryResponse { |
407 | 407 | $query = $this->buildSearchQuery($context, $sortingOrder); |
408 | 408 | |
@@ -449,8 +449,8 @@ discard block |
||
449 | 449 | * @return \Level23\Druid\Queries\SearchQuery |
450 | 450 | */ |
451 | 451 | protected function buildSearchQuery( |
452 | - array|QueryContext $context = [], |
|
453 | - string|SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
452 | + array | QueryContext $context = [], |
|
453 | + string | SortingOrder $sortingOrder = SortingOrder::LEXICOGRAPHIC |
|
454 | 454 | ): SearchQuery { |
455 | 455 | if (count($this->intervals) == 0) { |
456 | 456 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -499,7 +499,7 @@ discard block |
||
499 | 499 | * |
500 | 500 | * @return \Level23\Druid\Queries\SelectQuery |
501 | 501 | */ |
502 | - protected function buildSelectQuery(array|QueryContext $context = []): SelectQuery |
|
502 | + protected function buildSelectQuery(array | QueryContext $context = []): SelectQuery |
|
503 | 503 | { |
504 | 504 | if (count($this->intervals) == 0) { |
505 | 505 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -551,10 +551,10 @@ discard block |
||
551 | 551 | * @return \Level23\Druid\Queries\ScanQuery |
552 | 552 | */ |
553 | 553 | protected function buildScanQuery( |
554 | - array|QueryContext $context = [], |
|
554 | + array | QueryContext $context = [], |
|
555 | 555 | ?int $rowBatchSize = null, |
556 | 556 | bool $legacy = false, |
557 | - string|ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
557 | + string | ScanQueryResultFormat $resultFormat = ScanQueryResultFormat::NORMAL_LIST |
|
558 | 558 | ): ScanQuery { |
559 | 559 | if (count($this->intervals) == 0) { |
560 | 560 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -632,7 +632,7 @@ discard block |
||
632 | 632 | * |
633 | 633 | * @return TimeSeriesQuery |
634 | 634 | */ |
635 | - protected function buildTimeSeriesQuery(array|QueryContext $context = []): TimeSeriesQuery |
|
635 | + protected function buildTimeSeriesQuery(array | QueryContext $context = []): TimeSeriesQuery |
|
636 | 636 | { |
637 | 637 | if (count($this->intervals) == 0) { |
638 | 638 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -700,7 +700,7 @@ discard block |
||
700 | 700 | * |
701 | 701 | * @return TopNQuery |
702 | 702 | */ |
703 | - protected function buildTopNQuery(array|QueryContext $context = []): TopNQuery |
|
703 | + protected function buildTopNQuery(array | QueryContext $context = []): TopNQuery |
|
704 | 704 | { |
705 | 705 | if (count($this->intervals) == 0) { |
706 | 706 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -773,7 +773,7 @@ discard block |
||
773 | 773 | * |
774 | 774 | * @return GroupByQuery |
775 | 775 | */ |
776 | - protected function buildGroupByQuery(array|QueryContext $context = [], string $type = 'v2'): GroupByQuery |
|
776 | + protected function buildGroupByQuery(array | QueryContext $context = [], string $type = 'v2'): GroupByQuery |
|
777 | 777 | { |
778 | 778 | if (count($this->intervals) == 0) { |
779 | 779 | throw new InvalidArgumentException('You have to specify at least one interval'); |
@@ -836,7 +836,7 @@ discard block |
||
836 | 836 | * |
837 | 837 | * @return \Level23\Druid\Queries\QueryInterface |
838 | 838 | */ |
839 | - public function getQuery(array|QueryContext $context = []): QueryInterface |
|
839 | + public function getQuery(array | QueryContext $context = []): QueryInterface |
|
840 | 840 | { |
841 | 841 | // Check if this is a scan query. This is the preferred way to query when there are |
842 | 842 | // no aggregations done. |
@@ -29,7 +29,7 @@ discard block |
||
29 | 29 | * |
30 | 30 | * @return self |
31 | 31 | */ |
32 | - public function from(DataSourceInterface|string $dataSource): self |
|
32 | + public function from(DataSourceInterface | string $dataSource): self |
|
33 | 33 | { |
34 | 34 | return $this->dataSource($dataSource); |
35 | 35 | } |
@@ -41,7 +41,7 @@ discard block |
||
41 | 41 | * |
42 | 42 | * @return self |
43 | 43 | */ |
44 | - public function dataSource(DataSourceInterface|string $dataSource): self |
|
44 | + public function dataSource(DataSourceInterface | string $dataSource): self |
|
45 | 45 | { |
46 | 46 | if (is_string($dataSource)) { |
47 | 47 | $this->dataSource = new TableDataSource($dataSource); |
@@ -60,7 +60,7 @@ discard block |
||
60 | 60 | * |
61 | 61 | * @return self |
62 | 62 | */ |
63 | - public function join(DataSourceInterface|Closure|string $dataSourceOrClosure, string $as, string $condition, string|JoinType $joinType = JoinType::INNER): self |
|
63 | + public function join(DataSourceInterface | Closure | string $dataSourceOrClosure, string $as, string $condition, string | JoinType $joinType = JoinType::INNER): self |
|
64 | 64 | { |
65 | 65 | if ($this->dataSource instanceof TableDataSource && $this->dataSource->dataSourceName == '') { |
66 | 66 | throw new InvalidArgumentException('You first have to define your "from" dataSource before you can join!'); |
@@ -98,7 +98,7 @@ discard block |
||
98 | 98 | string $lookupName, |
99 | 99 | string $as, |
100 | 100 | string $condition, |
101 | - string|JoinType $joinType = JoinType::INNER |
|
101 | + string | JoinType $joinType = JoinType::INNER |
|
102 | 102 | ): self { |
103 | 103 | $lookupDataSource = new LookupDataSource($lookupName); |
104 | 104 | |
@@ -112,7 +112,7 @@ discard block |
||
112 | 112 | * |
113 | 113 | * @return self |
114 | 114 | */ |
115 | - public function leftJoin(DataSourceInterface|Closure|string $dataSourceOrClosure, string $as, string $condition): self |
|
115 | + public function leftJoin(DataSourceInterface | Closure | string $dataSourceOrClosure, string $as, string $condition): self |
|
116 | 116 | { |
117 | 117 | return $this->join($dataSourceOrClosure, $as, $condition, JoinType::LEFT); |
118 | 118 | } |
@@ -124,7 +124,7 @@ discard block |
||
124 | 124 | * |
125 | 125 | * @return self |
126 | 126 | */ |
127 | - public function innerJoin(DataSourceInterface|Closure|string $dataSourceOrClosure, string $as, string $condition): self |
|
127 | + public function innerJoin(DataSourceInterface | Closure | string $dataSourceOrClosure, string $as, string $condition): self |
|
128 | 128 | { |
129 | 129 | return $this->join($dataSourceOrClosure, $as, $condition); |
130 | 130 | } |
@@ -160,7 +160,7 @@ discard block |
||
160 | 160 | * @return $this |
161 | 161 | * @see https://druid.apache.org/docs/latest/querying/datasource.html#union |
162 | 162 | */ |
163 | - public function union(array|string $dataSources, bool $append = true): self |
|
163 | + public function union(array | string $dataSources, bool $append = true): self |
|
164 | 164 | { |
165 | 165 | $dataSources = (array)$dataSources; |
166 | 166 | |
@@ -183,7 +183,7 @@ discard block |
||
183 | 183 | * @return DataSourceInterface |
184 | 184 | * @throws InvalidArgumentException |
185 | 185 | */ |
186 | - protected function getDataSource(DataSourceInterface|Closure|string $dataSourceOrClosure): DataSourceInterface |
|
186 | + protected function getDataSource(DataSourceInterface | Closure | string $dataSourceOrClosure): DataSourceInterface |
|
187 | 187 | { |
188 | 188 | if ($dataSourceOrClosure instanceof DataSourceInterface) { |
189 | 189 | return $dataSourceOrClosure; |
@@ -12,5 +12,5 @@ |
||
12 | 12 | { |
13 | 13 | case SORTED_ARRAY = 'SORTED_ARRAY'; |
14 | 14 | case SORTED_SET = 'SORTED_SET'; |
15 | - case ARRAY = 'ARRAY'; |
|
15 | + case array = 'ARRAY'; |
|
16 | 16 | } |
17 | 17 | \ No newline at end of file |