This commit is contained in:
Alexey Milovidov 2022-08-22 00:39:06 +02:00
parent bddf1cc312
commit 2faa23112c
2 changed files with 3 additions and 2 deletions

View File

@ -736,6 +736,7 @@ inline ReturnType readDateTextImpl(ExtendedDayNum & date, ReadBuffer & buf)
readDateTextImpl<ReturnType>(local_date, buf);
else if (!readDateTextImpl<ReturnType>(local_date, buf))
return false;
/// When the parameter is out of rule or out of range, Date32 uses 1925-01-01 as the default value (-DateLUT::instance().getDayNumOffsetEpoch(), -16436) and Date uses 1970-01-01.
date = DateLUT::instance().makeDayNum(local_date.year(), local_date.month(), local_date.day(), -static_cast<Int32>(DateLUT::instance().getDayNumOffsetEpoch()));
return ReturnType(true);

View File

@ -1,13 +1,13 @@
CREATE TEMPORARY TABLE test (`i` Int64, `d` DateTime);
INSERT INTO test FORMAT JSONEachRow {"i": 123, "d": "2022-05-03"};
INSERT INTO test FORMAT JSONEachRow {"i": 456, "d": "2022-05-03 01:02:03"};
SELECT * FROM test;
SELECT * FROM test ORDER BY i;
DROP TABLE test;
CREATE TEMPORARY TABLE test (`i` Int64, `d` DateTime64);
INSERT INTO test FORMAT JSONEachRow {"i": 123, "d": "2022-05-03"};
INSERT INTO test FORMAT JSONEachRow {"i": 456, "d": "2022-05-03 01:02:03"};
SELECT * FROM test;
SELECT * FROM test ORDER BY i;
DROP TABLE test;