diff --git a/src/Functions/toStartOfInterval.cpp b/src/Functions/toStartOfInterval.cpp index e358addf972..cc5ffd56976 100644 --- a/src/Functions/toStartOfInterval.cpp +++ b/src/Functions/toStartOfInterval.cpp @@ -192,6 +192,8 @@ public: case ResultType::DateTime64: { UInt32 scale = 0; + if (isDateTime64(arguments[0].type) && overload == Overload::Origin) + scale = assert_cast(*arguments[0].type.get()).getScale(); if (interval_type->getKind() == IntervalKind::Kind::Nanosecond) scale = (9 > scale) ? 9 : scale; else if (interval_type->getKind() == IntervalKind::Kind::Microsecond)