Merge pull request #37775 from liuneng1994/fix_date32_to_string

fix toString error on DatatypeDate32
This commit is contained in:
Alexander Gololobov 2022-06-02 16:40:47 +03:00 committed by GitHub
commit b34782dc6a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 1 deletions

View File

@ -705,7 +705,7 @@ template <>
struct FormatImpl<DataTypeDate32>
{
template <typename ReturnType = void>
static ReturnType execute(const DataTypeDate::FieldType x, WriteBuffer & wb, const DataTypeDate32 *, const DateLUTImpl *)
static ReturnType execute(const DataTypeDate32::FieldType x, WriteBuffer & wb, const DataTypeDate32 *, const DateLUTImpl *)
{
writeDateText(ExtendedDayNum(x), wb);
return ReturnType(true);

View File

@ -283,3 +283,9 @@
1925-01-01 \N
1925-01-01
\N
1925-01-01
1969-12-31
1970-01-01
2149-06-06
2149-06-07
2283-11-11

View File

@ -118,4 +118,15 @@ select toDate32OrZero('1924-01-01'), toDate32OrNull('1924-01-01');
select toDate32OrZero(''), toDate32OrNull('');
select (select toDate32OrZero(''));
select (select toDate32OrNull(''));
SELECT toString(T.d) dateStr
FROM
(
SELECT '1925-01-01'::Date32 d
UNION ALL SELECT '1969-12-31'::Date32
UNION ALL SELECT '1970-01-01'::Date32
UNION ALL SELECT '2149-06-06'::Date32
UNION ALL SELECT '2149-06-07'::Date32
UNION ALL SELECT '2283-11-11'::Date32
) AS T
ORDER BY T.d