Fix error in parseDateTimeBestEffort

This commit is contained in:
Alexey Milovidov 2020-08-07 02:52:18 +03:00
parent cece629145
commit 241017bc1f
4 changed files with 9 additions and 0 deletions

View File

@ -1,6 +1,7 @@
#pragma once #pragma once
#include <cstddef> #include <cstddef>
#include <cassert>
#include <type_traits> #include <type_traits>
#include <common/defines.h> #include <common/defines.h>
@ -11,6 +12,7 @@
*/ */
inline unsigned int bitScanReverse(unsigned int x) inline unsigned int bitScanReverse(unsigned int x)
{ {
assert(x != 0);
return sizeof(unsigned int) * 8 - 1 - __builtin_clz(x); return sizeof(unsigned int) * 8 - 1 - __builtin_clz(x);
} }

View File

@ -104,6 +104,7 @@ ReturnType parseDateTimeBestEffortImpl(
return false; return false;
}; };
res = 0;
UInt16 year = 0; UInt16 year = 0;
UInt8 month = 0; UInt8 month = 0;
UInt8 day_of_month = 0; UInt8 day_of_month = 0;

View File

@ -0,0 +1,3 @@
2020-08-07 01:29:00
1973-03-03 12:46:40
2020-08-07 00:00:00

View File

@ -0,0 +1,3 @@
SELECT parseDateTimeBestEffort('1596752940', 'Europe/Moscow');
SELECT parseDateTimeBestEffort('100000000', 'Europe/Moscow');
SELECT parseDateTimeBestEffort('20200807', 'Europe/Moscow');