diff --git a/src/Functions/roundAge.cpp b/src/Functions/roundAge.cpp index d2503bb6938..5c6f9b65279 100644 --- a/src/Functions/roundAge.cpp +++ b/src/Functions/roundAge.cpp @@ -15,8 +15,7 @@ struct RoundAgeImpl static inline ResultType apply(A x) { - return x < 1 ? 0 - : (x < 18 ? 17 + return (x < 18 ? 0 : (x < 25 ? 18 : (x < 35 ? 25 : (x < 45 ? 35 diff --git a/tests/queries/0_stateless/00968_roundAge.sql b/tests/queries/0_stateless/00968_roundAge.sql index c8e5a5579f2..f092dbf6560 100644 --- a/tests/queries/0_stateless/00968_roundAge.sql +++ b/tests/queries/0_stateless/00968_roundAge.sql @@ -1,7 +1,8 @@ SELECT roundAge(0); +SELECT roundAge(12); SELECT roundAge(18); SELECT roundAge(25); SELECT roundAge(35); SELECT roundAge(45); SELECT roundAge(55); -SELECT roundAge(56); \ No newline at end of file +SELECT roundAge(56);