Skip to content

Commit e0ce0c4

Browse files
committed
fix: improve SUM aggregate type detection logic
1 parent 10f4866 commit e0ce0c4

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

packages/database/src/Builder/QueryBuilders/SelectQueryBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ private function aggregate(AggregateFunction $function, string $column): mixed
461461

462462
return match ($function) {
463463
AggregateFunction::AVG => (float) $result,
464-
AggregateFunction::SUM => filter_var(value: $result, filter: FILTER_VALIDATE_INT) !== false ? (int) $result : (float) $result,
464+
AggregateFunction::SUM => str(string: (string) $result)->contains(needle: '.') ? (float) $result : (int) $result,
465465
default => $result,
466466
};
467467
}

0 commit comments

Comments
 (0)