Skip to content

Commit f3c47fc

Browse files
noescomnoescom
authored andcommitted
Optimizations
1 parent 9560c83 commit f3c47fc

File tree

3 files changed

+10
-4
lines changed

3 files changed

+10
-4
lines changed

src/Execution/Optimizers/AggregateOptimizer.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,6 @@ private function passesWindowFunctionBasics(AstInterface $aggregate): bool {
318318
}
319319

320320
// One of the supported aggregates (no distinct)
321-
$supported = [AstSum::class, AstCount::class, AstAvg::class, AstMin::class, AstMax::class,];
322-
return in_array(get_class($aggregate), $supported, true);
321+
return in_array(get_class($aggregate), AggregateConstants::NOT_DISTINCT_AGGREGATE_TYPES, true);
323322
}
324323
}

src/Execution/QueryExecutor.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,6 @@ private function executeSimpleQueryDatabase(ExecutionStage $stage, array $initia
158158
// Convert the query to SQL
159159
$sql = $this->convertToSQL($stage->getQuery(), $initialParams);
160160

161-
dd($sql);
162-
163161
// Execute the SQL query
164162
$rs = $this->connection->execute($sql, $initialParams);
165163

src/Execution/Support/AggregateConstants.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ class AggregateConstants {
2626
AstMax::class,
2727
];
2828

29+
/** @var array<class-string<AstInterface>> NOT-DISTINCT-capable aggregate classes. */
30+
public const array NOT_DISTINCT_AGGREGATE_TYPES = [
31+
AstSum::class,
32+
AstCount::class,
33+
AstAvg::class,
34+
AstMin::class,
35+
AstMax::class
36+
];
37+
2938
/** @var array<class-string<AstInterface>> DISTINCT-capable aggregate classes. */
3039
public const array DISTINCT_AGGREGATE_TYPES = [
3140
AstSumU::class,

0 commit comments

Comments
 (0)