Commit Graph

217 Commits

Author SHA1 Message Date
Pavel Kruglov
7c98fc11b9 Fix performance, make only one setting 2021-08-16 14:30:56 +03:00
Alexey Milovidov
8adaef7c8e Make text format for Decimal tuneable 2021-08-16 11:03:23 +03:00
mergify[bot]
319e5af6eb
Merge branch 'master' into short-circuit 2021-08-13 13:01:46 +00:00
kssenii
dcc6f597dc Move templates from FunctionsConvertion 2021-08-11 19:09:51 +00:00
kssenii
7555fc19fd Revert "Move some templates"
This reverts commit 7f247becca.
2021-08-11 18:49:25 +00:00
kssenii
7f247becca Move some templates 2021-08-11 07:32:46 +00:00
Anton Popov
5a2daae63a add conversion from tuple to object 2021-08-10 04:33:57 +03:00
Pavel Kruglov
1fa8901cdb Mark functions conversion as suitable for short-circuit 2021-08-09 18:02:09 +03:00
Pavel Kruglov
70b51133c1 Try to simplify code 2021-08-09 18:01:08 +03:00
Pavel Kruglov
bff79d7774 Fix special build 2021-08-09 17:57:50 +03:00
Pavel Kruglov
a95d45a157 Some clean up 2021-08-09 17:57:02 +03:00
Pavel Kruglov
3ec2ab6156 Avoid using expand, fix bugs, add tests and comments 2021-08-09 17:54:49 +03:00
Pavel Kruglov
0662df8b76 Fix performance with JIT, add arguments to function isSuitableForShortCircuitArgumentsExecution 2021-08-09 17:54:14 +03:00
Pavel Kruglov
e792fa588f Mark all Functions as sutable or not for executing as short circuit arguments 2021-08-09 17:50:09 +03:00
kssenii
01b4bd3f91 Fix some more tests 2021-08-07 14:28:12 +00:00
kssenii
ec9e82fb0c Fix some tests 2021-08-07 10:12:59 +00:00
kssenii
9ca422f0c5 Introduce CAST for internal usage 2021-08-07 09:03:10 +00:00
Anton Popov
f99374cca6 Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-07-20 18:20:21 +03:00
kssenii
9cb10aae3c Some fixes 2021-07-18 03:43:08 +00:00
kssenii
3ba2d114d5 Revert "Merge pull request #26352 from ClickHouse/revert-25774-datatype-date32"
This reverts commit 94a210650f, reversing
changes made to 0893b9ff8e.
2021-07-15 11:41:52 +00:00
alexey-milovidov
9ba4064c86
Revert "Datatype Date32, support range 1925 to 2283" 2021-07-15 10:53:35 +03:00
Vladimir
c6177bd0cc
Merge pull request #26123 from vdimir/issue-25806-null-enum-to-str 2021-07-14 10:22:37 +03:00
vdimir
a01f8c147d
Move check of null_map outside of loop in ConvertImpl::execute for toString 2021-07-13 09:52:31 +03:00
vdimir
c938a53e88
Fixes for FunctionConversion implementation for nulls 2021-07-13 09:48:05 +03:00
vdimir
b4c6a17eb2
Add ReturnType template parameter to FormatImpl::execute 2021-07-13 09:48:05 +03:00
vdimir
32b174403e
Nullable in ConvertImplGenericToString 2021-07-13 09:48:04 +03:00
vdimir
3a0a456549
Do not try catch in ConvertImpl::execute 2021-07-13 09:48:04 +03:00
vdimir
5b18480a49
Return null if value can't be converted in toString for nullable 2021-07-13 09:48:04 +03:00
vdimir
7c4c2b29c2
Do not throw exception for unexpected values in enum during to string conversion 2021-07-13 09:48:04 +03:00
Anton Popov
072e65b728 Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-07-07 17:20:38 +03:00
neng.liu
ec7604b013 add parquet test and fix add interval error when type is date32 2021-06-28 16:36:54 +08:00
Neng Liu
7ed1728a37 Merge branch 'master' into datatype-date32
# Conflicts:
#	src/DataTypes/IDataType.h
#	src/Functions/CustomWeekTransforms.h
2021-06-22 10:00:18 +08:00
Alexey Milovidov
3e71181451 Whitespaces 2021-06-18 01:42:33 +03:00
Maksim Kita
67e9b85951 Merge ext into common 2021-06-16 23:28:41 +03:00
Neng Liu
88a0d0be62 add datetype32 part2 2021-06-08 20:31:41 +08:00
Anton Popov
205a23282b Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-06-07 19:38:22 +03:00
mergify[bot]
d68d5e0ef1
Merge branch 'master' into rename-const-context-ptr 2021-06-04 14:41:41 +00:00
Kruglov Pavel
8acf031c1b
Merge pull request #24398 from Avogar/fix-deltasum
Fix logical error AggregateFunctionFactory returned nullptr
2021-06-03 19:40:06 +03:00
Nikolai Kochetov
dbaa6ffc62 Rename ContextConstPtr to ContextPtr. 2021-06-01 15:20:52 +03:00
Anton Popov
9f52362b81 Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-05-31 23:08:45 +03:00
Alexander Kuzmenkov
3f57fc085b remove mutable context references from functions interface
Also remove it from some visitors.
2021-05-28 19:45:37 +03:00
Pavel Kruglov
42d57138f2 replace all isDateOrDateTime invocations to explicit calls to isDate and isDateTime and isDateTime64 2021-05-28 15:34:49 +03:00
Anton Popov
041e2def3e fix conversion of tuples 2021-05-28 03:53:39 +03:00
Anton Popov
d83819fcae fix build 2021-05-26 18:34:34 +03:00
Anton Popov
13ae56985f dynamic subcolumns: better handling of missed values 2021-05-26 05:41:38 +03:00
Anton Popov
0bdf9d207c Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-05-26 00:25:47 +03:00
Anton Popov
35e2cc7b2b fix several cases in cast operator 2021-05-25 02:50:28 +03:00
Maksim Kita
fa24fe82e1 Fixed FunctionConversion tests 2021-05-16 18:17:05 +03:00
Maksim Kita
947f28d430 IFunction refactoring 2021-05-15 20:33:15 +03:00
Alexey Milovidov
02ce9cc725 Untangle UUID 2021-05-04 01:46:51 +03:00
Alexey Milovidov
0677787d90 Fix abysmally low performance 2021-05-03 22:56:40 +03:00
Alexey Milovidov
8ecd9d36e6 Add UInt128 conversion functions 2021-05-03 18:41:37 +03:00
Anton Popov
3bc2a0820c dynamic subcolumns: support merges 2021-05-03 03:56:19 +03:00
Alexey Milovidov
649550c5ab Attempt to normalize big integers 2021-04-25 12:30:43 +03:00
Maksim Kita
ddcffcb723 Fixed tests 2021-04-22 00:19:01 +03:00
Maksim Kita
631d870ae3 Cast to array from empty array 2021-04-21 20:29:49 +03:00
Ivan
495c6e03aa
Replace all Context references with std::weak_ptr (#22297)
* Replace all Context references with std::weak_ptr

* Fix shared context captured by value

* Fix build

* Fix Context with named sessions

* Fix copy context

* Fix gcc build

* Merge with master and fix build

* Fix gcc-9 build
2021-04-11 02:33:54 +03:00
Anton Popov
329c9033a8 fix conversion from const map with nulls 2021-04-09 20:50:10 +03:00
Anton Popov
6a15431be7 Merge remote-tracking branch 'upstream/master' into HEAD 2021-03-25 15:57:35 +03:00
alexey-milovidov
150a2df9df
Merge pull request #22026 from kitaisreal/cast-to-enum-nullable-fix
Cast to enum nullable fix
2021-03-23 23:51:19 +03:00
Maksim Kita
75f5679bf0 Cast to enum nullable fix 2021-03-23 14:58:00 +03:00
Alexey Milovidov
3f67f4f47b Saturation for DateTime 2021-03-15 23:40:33 +03:00
Anton Popov
81ac6382a3 slightly better performance 2021-03-13 21:05:18 +03:00
Anton Popov
bc417cf54a refactoring of serializations 2021-03-09 17:46:52 +03:00
Alexey Milovidov
4e8239e098 Merge branch 'master' into DateTime64_extended_range 2021-03-03 23:43:20 +03: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
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