Skip to content

Commit dca8bac

Browse files
laylatichygitbutler-client
authored andcommitted
fix: improve SUM aggregate type detection logic
1 parent 10f4866 commit dca8bac

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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_contains(haystack: (string) $result, needle: '.') ? (float) $result : (int) $result,
465465
default => $result,
466466
};
467467
}

0 commit comments

Comments
 (0)