diff --git a/src/Interpreters/convertFieldToType.cpp b/src/Interpreters/convertFieldToType.cpp index 9bea9f6851f..ba02eefabc9 100644 --- a/src/Interpreters/convertFieldToType.cpp +++ b/src/Interpreters/convertFieldToType.cpp @@ -192,11 +192,11 @@ Field convertFieldToTypeImpl(const Field & src, const IDataType & type, const ID { return static_cast(type).getTimeZone().fromDayNum(DayNum(src.get())); } - else if(which_type.isDateTime64() && which_from_type.isDate()) { + else if (which_type.isDateTime64() && which_from_type.isDate()) { const auto value = static_cast(type).getTimeZone().fromDayNum(DayNum(src.get())); return DecimalUtils::decimalFromComponentsWithMultiplier(value, 0, 1); } - else if(which_type.isDateTime64() && which_from_type.isDate32()) { + else if (which_type.isDateTime64() && which_from_type.isDate32()) { const auto value = static_cast(type).getTimeZone().fromDayNum(DayNum(src.get())); return DecimalUtils::decimalFromComponentsWithMultiplier(value, 0, 1); } diff --git a/tests/queries/1_stateful/00178_query_datetime64_index.sql b/tests/queries/1_stateful/00178_query_datetime64_index.sql index 68542bc0524..a3fb594db73 100644 --- a/tests/queries/1_stateful/00178_query_datetime64_index.sql +++ b/tests/queries/1_stateful/00178_query_datetime64_index.sql @@ -3,7 +3,7 @@ DROP TABLE IF EXISTS datetime64_index_tbl; CREATE TABLE datetime64_index_tbl(ts DateTime64(3, 'UTC')) ENGINE=MergeTree ORDER BY ts; INSERT INTO datetime64_index_tbl(ts) VALUES(toDateTime64('2023-05-27 00:00:00', 3, 'UTC')); -SELECT ts from datetime64_index_tbl where ts < toDate('2023-05-28'); -SELECT ts from datetime64_index_tbl where ts < toDate32('2023-05-28'); +SELECT ts FROM datetime64_index_tbl WHERE ts < toDate('2023-05-28'); +SELECT ts FROM datetime64_index_tbl WHERE ts < toDate32('2023-05-28'); DROP TABLE datetime64_index_tbl;