Commit Graph

102 Commits

Author SHA1 Message Date
Anton Popov
bc417cf54a refactoring of serializations 2021-03-09 17:46:52 +03:00
hexiaoting
e123c6ef9d Bug fix: Tuple cast to Map 2021-02-23 18:42:33 +08:00
Azat Khuzhin
521537eed8 Fix DateTime64 from Float 2021-02-21 22:36:40 +03:00
Alexey Milovidov
4085782b05 More gentle exception messages 2021-02-21 15:34:48 +03:00
Azat Khuzhin
46ff7d2ab0 Fix DateTime64 overflows 2021-02-07 02:24:31 +03:00
Azat Khuzhin
c4b5eed4ff Fix DateTime64 initialization (to match DateTime behaviour)
There was no specializations for toDateTime64(<numeric>), and because of
this default decimal conversion was used, however this is not enough for
DateTime/DateTime64 types, since the date may overflow and the proper
check is required (like DateTime has), and this what UBsan found [1]:

    ../src/IO/WriteHelpers.h:812:33: runtime error: index 508 out of bounds for type 'const char [201]' Received signal -3 Received signal Unknown signal (-3)

Backtrace:

    (gdb) bt
    0  LocalDateTime::LocalDateTime (this=0x7fffffff8418, year_=1970, month_=1 '\001', day_=1 '\001', hour_=2 '\002', minute_=0 '\000', second_=254 '\376') at LocalDateTime.h:83
    1  0x00000000138a5edb in DB::writeDateTimeText<(char)45, (char)58, (char)32, (char)46> (datetime64=..., scale=7, buf=..., date_lut=...) at WriteHelpers.h:852
    2  0x0000000019c379b4 in DB::DataTypeDateTime64::serializeText (this=0x7ffff5c4b0d8, column=..., row_num=0, ostr=..., settings=...) at DataTypeDateTime64.cpp:66
    3  0x0000000019d297e4 in DB::IDataType::serializeAsText (this=0x7ffff5c4b0d8, column=..., row_num=0, ostr=..., settings=...) at IDataType.cpp:387

  [1]: https://clickhouse-test-reports.s3.yandex.net/19527/cea8ae162ffbf92e5ed29304ab010704c5d611c8/fuzzer_ubsan/report.html#fail1

Also fix CAST for DateTime64
2021-02-06 13:04:53 +03:00
Azat Khuzhin
0627ba0e36 Fix timezone argument for DateTime64
It should be marked with always const, otherwise it will bail:

    Code: 44, e.displayText() = DB::Exception: Illegal column String of time zone argument of function, must be constant string: While processing toDateTime(-1, 1, 'GMT'), Stack trace (when copying this message, always include the lines below):
2021-02-06 13:04:53 +03:00
Maksim Kita
9db9ce11dc Added functions parseDateTimeBestEffortUSOrZero, parseDateTimeBestEffortUSOrNull 2021-01-27 17:10:06 +03:00
Maksim Kita
d712748304 Function accurateCastOrNull fixed unitialized values for numeric cast 2021-01-22 16:24:51 +03:00
tavplubix
00d240853d
Merge pull request #18718 from zhang2014/fix/ISSUES-7690
ISSUES-7690 try fix nullable string type convert to decimal type
2021-01-11 16:18:56 +03:00
zhang2014
cccafcfc3d try fix build failure 2021-01-08 18:29:51 +08:00
Alexey Milovidov
039edbb724 Don't allow conversion between UUID and numeric types 2021-01-05 01:33:59 +03:00
zhang2014
84ddff92f2 ISSUES-7690 try fix nullable string type convert to decimal type 2021-01-04 20:40:33 +08:00
Anton Popov
721bb60edd fix cast to map from tuple of arrays with unequal sizes 2020-12-25 20:12:47 +03:00
Alexander Tokmakov
c49a6302fa fix, add test 2020-12-24 03:13:53 +03:00
Alexander Tokmakov
317df5f5d2 try fix 'value is too short' when converting from String to Nullable(T) 2020-12-24 00:57:33 +03:00
alexey-milovidov
6fc3ca8b7b
Merge pull request #16724 from kitaisreal/added-function-accurate-cast-or-null
Added function accurateCastOrNull, allow different types inside IN subquery
2020-12-18 00:45:27 +03:00
Maksim Kita
9aaa2f9345 Fixed compilation timeout 2020-12-17 21:32:25 +03:00
Anton Popov
b485b5bd1c minor fixes and comments added 2020-12-16 01:22:21 +03:00
Maksim Kita
4e3cc606e6 Fixed tests 2020-12-15 23:36:45 +03:00
Maksim Kita
51f53ce8e9 Added tryParseDecimal functions 2020-12-15 21:54:16 +03:00
Anton Popov
dd09e1d783 fix type map ser/de to json 2020-12-15 17:34:37 +03:00
Anton Popov
afc2d7099b add conversion from array to map 2020-12-15 01:16:04 +03:00
Maksim Kita
17b43ca721 Fixed tests 2020-12-14 22:12:15 +03:00
Maksim Kita
16a30eb4aa Updated non-finite floating conversion into int 2020-12-14 22:12:15 +03:00
Maksim Kita
0b565b679e Fixed Set execute for columns that cannot be inside Nullable 2020-12-14 22:12:15 +03:00
Maksim Kita
18dc118298 Fixed compile issues 2020-12-14 22:12:15 +03:00
Maksim Kita
0464859cfe Updated usage of different types during IN query
1. Added accurateCast function.
2. Use accurateCast in Set during execute.
3. Added accurateCast tests.
4. Updated select_in_different_types tests.
2020-12-14 22:12:15 +03:00
Maksim Kita
f4b8e8ef99 Allow different types inside IN subquery 2020-12-14 22:12:15 +03:00
Maksim Kita
dd072a20c9 Fixed compile issues 2020-12-14 22:12:15 +03:00
Maksim Kita
4435642e39 Fixed style issues 2020-12-14 22:12:15 +03:00
Maksim Kita
db5d0944ed Added Decimal support 2020-12-14 22:12:15 +03:00
Maksim Kita
baad78d2f2 Fixed setting null value in vector. Updated tests. 2020-12-14 22:12:15 +03:00
Maksim Kita
4cd5025e83 Added numeric limits for UInt128 2020-12-14 22:12:15 +03:00
Maksim Kita
d636e1618b Added function accurate cast or null 2020-12-14 22:12:15 +03:00
Anton Popov
6b09669d66 data type map: several fixes 2020-12-05 22:36:09 +03:00
Anton Popov
12604ce0e6 Merge branch 'dev_map2' of git://github.com/hexiaoting/ClickHouse into merging-map 2020-12-01 14:52:30 +03:00
Azat Khuzhin
ee38cce1bf Fix toUnixTimestamp(Date()) error (use type name not column type name)
Was:
    Code: 44. DB::Exception: Received from localhost:9000. DB::Exception: Illegal column UInt16 of first argument of function toUnixTimestamp: While processing toUnixTimestamp(today()).

Now:
    Code: 44. DB::Exception: Received from localhost:9000. DB::Exception: Illegal type Date of first argument of function toUnixTimestamp: While processing toUnixTimestamp(today()).
2020-11-28 15:05:48 +03:00
hexiaoting
5b3a7f5c98 Merge remote-tracking branch 'origin/master' into dev_map2 2020-11-26 16:43:27 +08:00
Azat Khuzhin
17f6c82ffa Prohibit toUnixTimestamp(Date())
Making it implicitly cast to Date() does not looks correct, since before
it returns somewhat unexpected result:

    SELECT toUnixTimestamp(today())

    ┌─toUnixTimestamp(today())─┐
    │                    18591 │
    └──────────────────────────┘
2020-11-25 00:26:14 +03:00
alexey-milovidov
1663b13215
Merge pull request #17257 from ucasFL/fix
fix toUInt256 stack overflow
2020-11-21 22:54:06 +03:00
fenglv
268b15f221 fix toUInt256 stack overflow 2020-11-21 12:59:40 +00:00
Nikolai Kochetov
cf678b6092 Merge branch 'master' into order-inputs-in-action-dag 2020-11-21 13:54:50 +03:00
Nikolai Kochetov
266596783a Remove Converting transform and step. 2020-11-18 12:45:46 +03:00
Nikolai Kochetov
947a29e378 Remove Converting transform and step. 2020-11-18 12:38:03 +03:00
Nikolai Kochetov
354620b5a1 Remove Converting transform and step. 2020-11-18 12:35:32 +03:00
Ivan Lezhankin
f897f7c93f Refactor IFunction to execute with const arguments 2020-11-17 16:24:45 +03:00
hexiaoting
66bca89001 Style error fix 2020-11-02 17:23:02 +08:00
hexiaoting
3a70cf3773 Merge remote-tracking branch 'origin/master' into dev_map2 2020-11-02 14:46:56 +08:00
hexiaoting
e1ff6c3870 Update codes 2020-11-02 14:46:32 +08:00