Commit Graph

66 Commits

Author SHA1 Message Date
Azat Khuzhin
2561a67fd8 Replace !__clang__ with !defined(__clang) to fix gcc builds
$ gg 'if !__clang__' | cut -d: -f1 | sort -u | xargs sed -i 's/#if !__clang__/#if !defined(__clang__)/g'
2021-04-18 23:37:50 +03:00
Alexey Milovidov
7fcae60466 Merge branch 'master' into to-start-of-interval-hour-align 2021-03-29 05:42:00 +03:00
Alexey Milovidov
ea3cf5c0a7 Fix typo 2021-03-24 22:48:39 +03:00
Alexey Milovidov
b610afe771 Another fix 2021-03-24 22:40:45 +03:00
Alexey Milovidov
5a2f2e0cc8 Change behaviour of toStartOfInterval in backward incompatible way 2021-03-24 01:53:19 +03:00
Alexey Milovidov
3952a8e976 Fix UBSan report in addMonths 2021-03-22 23:42:09 +03:00
Alexey Milovidov
de091114f3 Fix UBSan report 2021-03-16 15:22:52 +03:00
Alexey Milovidov
f48bf2aaba Fix issue 2021-03-15 23:29:35 +03:00
Alexey Milovidov
671395e8c8 Most likely improve performance 2021-03-15 22:23:27 +03:00
Alexey Milovidov
845f4afbf4 Fix parsing of pre-epoch time 2021-03-15 21:09:05 +03:00
Alexey Milovidov
badd5165da Fix UBSan report in rounding to years intervals 2021-03-15 20:36:49 +03:00
Alexey Milovidov
1200d9d9c5 Range checks and monotonicity 2021-03-07 10:10:37 +03:00
Alexey Milovidov
7052ecd446 Fix error 2021-03-07 09:30:52 +03:00
Alexey Milovidov
1bb62f578b Unit tests passing 2021-03-07 04:10:38 +03:00
Alexey Milovidov
0dbadc8d8e Fix error 2021-03-07 01:35:23 +03:00
Alexey Milovidov
8d5d1b76fb Fix error 2021-03-07 00:36:29 +03:00
Alexey Milovidov
d276fac135 Support negative time_t in more functions 2021-03-05 05:04:23 +03:00
Alexey Milovidov
738d106874 Support negative time_t in more functions 2021-03-05 05:03:55 +03:00
Alexey Milovidov
790aa8697c Fix typos 2021-03-05 04:47:50 +03:00
Alexey Milovidov
1722978c2b Comments and corrections 2021-03-05 04:45:12 +03:00
Alexey Milovidov
b9a8509f79 Adjustments 2021-03-04 05:18:17 +03:00
Alexey Milovidov
31010624d6 Attempt to simplify code 2021-03-04 03:35:23 +03:00
Alexey Milovidov
4f08539754 Remove strange code 2021-03-04 03:01:08 +03:00
Alexey Milovidov
51d51e4748 Return private 2021-03-04 00:44:58 +03:00
Alexey Milovidov
fdc00beb77 Whitespaces 2021-03-03 23:56:59 +03:00
Alexey Milovidov
6f5877abdf Fix build after merge with master 2021-03-03 23:53:52 +03:00
Alexey Milovidov
4e8239e098 Merge branch 'master' into DateTime64_extended_range 2021-03-03 23:43:20 +03:00
Alexey Milovidov
b1b3db09d7 Remove commented out code 2021-03-03 23:34:15 +03:00
Alexey Milovidov
ed0099a113 Maybe unused condition 2021-03-03 23:24:56 +03:00
Alexey Milovidov
aaef0c5ebd Fix build 2021-03-03 23:19:26 +03:00
Alexey Milovidov
cf0912ba02 Remove unused field 2021-03-03 23:14:33 +03:00
alexey-milovidov
3e19f4a00f
Update DateLUTImpl.h 2021-03-03 23:09:59 +03:00
alexey-milovidov
0889e0da87
Update DateLUTImpl.h 2021-03-03 22:52:07 +03:00
alexey-milovidov
2f23f1b123
Update DateLUTImpl.h 2021-03-03 22:49:20 +03:00
alexey-milovidov
3bd180c416
Merge pull request #20149 from keen-wolf/timezone_about
fix toMinute function to handle special timezone
2021-02-28 21:53:51 +03:00
keenwolf
303c389b36 change the time_t to unsigned to handle properly the start date of 1970-01-01 2021-02-28 18:11:54 +08:00
alexey-milovidov
d5757c67e6 Update DateLUTImpl.h 2021-02-24 17:09:27 +02:00
alexey-milovidov
b8b916008c Update DateLUTImpl.h 2021-02-24 17:09:27 +02:00
Vasily Nemkov
7a53daaefd Fixed issues reported by PVS-Studio and Clang11/GCC10 2021-02-24 17:08:43 +02:00
Vasily Nemkov
4fcc23ec9a Fixed build for GCC-10 2021-02-24 17:08:43 +02:00
Vasily Nemkov
2d03d330bc Extended range of DateTime64 to years 1925 - 2238
The Year 1925 is a starting point because most of the timezones
switched to saner (mostly 15-minutes based) offsets somewhere
during 1924 or before. And that significantly simplifies implementation.

2238 is to simplify arithmetics for sanitizing LUT index access;
there are less than 0x1ffff days from 1925.

* Extended DateLUTImpl internal LUT to 0x1ffff items, some of which
  represent negative (pre-1970) time values.
  As a collateral benefit, Date now correctly supports dates up to 2149
  (instead of 2106).
* Added a new strong typedef ExtendedDayNum, which represents dates
  pre-1970 and post 2149.
* Functions that used to return DayNum now return ExtendedDayNum.
* Refactored DateLUTImpl to untie DayNum from the dual role of being
  a value and an index (due to negative time). Index is now a different
  type LUTIndex with explicit conversion functions from DatNum, time_t,
  and ExtendedDayNum.
* Updated DateLUTImpl to properly support values close to epoch start
  (1970-01-01 00:00), including negative ones.
* Reduced resolution of DateLUTImpl::Values::time_at_offset_change
  to multiple of 15-minutes to allow storing 64-bits of time_t in
  DateLUTImpl::Value while keeping same size.
* Minor performance updates to DateLUTImpl when building month LUT
  by skipping non-start-of-month days.
* Fixed extractTimeZoneFromFunctionArguments to work correctly
  with DateTime64.
* New unit-tests and stateless integration tests for both DateTime
  and DateTime64.
2021-02-24 17:08:35 +02:00
Alexey Milovidov
d2a9e5842a Fix wrong formatting of overflowed DateTime64 2021-02-21 21:01:46 +03:00
keenwolf
610798aa48 fix the toMinute bug which will cause toDateTime or toString printing wrong time 2021-02-06 15:32:49 +08:00
Nikolai Kochetov
c39c965612
Merge pull request #19962 from keen-wolf/timezoneOffset
Implement the timezoneOffset function
2021-02-03 20:37:34 +03:00
keenwolf
9beb7689cc add comments and update test cases. 2021-02-02 23:35:45 +08:00
keenwolf
d251807ea4 add function timezoneOffset 2021-02-02 11:01:20 +08:00
Azat Khuzhin
f4a4d33c2d Suppress UBsan reports in addYears()
https://clickhouse-test-reports.s3.yandex.net/19528/1c364b6ee3a44487529954cf2792e615f7de0f82/fuzzer_ubsan/report.html#fail1
2021-01-26 01:12:40 +03:00
alexey-milovidov
77af612bc5
Merge pull request #19466 from azat/UBsan-report-fixes
UBsan report fixes (arraySlice, addMinutes/addHours/addWeeks/addDays, sumWithOverflow(Decimal))
2021-01-24 22:27:15 +03:00
Azat Khuzhin
cb30a02540 Fix UBsan report in addDays(INT64_MAX)
https://clickhouse-test-reports.s3.yandex.net/19466/df53438a66ee95de790b60d35f36eca986590027/fuzzer_ubsan/report.html#fail1
2021-01-24 13:51:05 +03:00
Alexey Milovidov
505898747e Fix buffer overflow in DateLUT 2021-01-23 01:58:41 +03:00