Commit Graph

826 Commits

Author SHA1 Message Date
zhao zhou
ad1f0c025e change some comment 2022-05-20 05:52:21 +08:00
zhao zhou
58518047fe iterator not always pointer type. so use the auto* substitue auto that clang tidy suggest is not alwyas ok. 2022-05-19 19:13:12 +08:00
zhao zhou
44f2e3a06d change comment 2022-05-19 02:49:26 +08:00
Anton Popov
03c51118d5 better implementation of ColumnObject 2022-05-18 14:15:55 +00:00
zhao zhou
c1bcf932ec Merge branch 'column_replicate_optimize_v2' of https://github.com/zzachimed/ClickHouse into column_replicate_optimize_v2 2022-05-18 21:12:57 +08:00
zhao zhou
dbea0c122e change macro from sse4.2 to sse2 2022-05-18 21:10:01 +08:00
Anton Popov
7477cf28a9 fix some cases of insertion nested arrays to columns of type Object 2022-05-17 22:59:16 +00:00
zhao zhou
4b2a24b5ec change comment format 2022-05-16 23:31:54 +08:00
zhao zhou
fa2afb292c Improve performance for column replicate for uint32 type. In our benchmark unit test there has about 2x performance boost
Co-authored-by: vesslanjin <jun.i.jin@intel.com>
2022-05-16 22:48:37 +08:00
mergify[bot]
e7cfc6fd49
Merge branch 'master' into column_replicate_optimize_v2 2022-05-16 08:09:48 +00:00
Maksim Kita
437d70d4da Fixed tests 2022-05-11 21:59:51 +02:00
Maksim Kita
c17a8b1a23 Fixed tests 2022-05-11 21:59:51 +02:00
Maksim Kita
8721e434e6 Fixed tests 2022-05-11 21:59:51 +02:00
Maksim Kita
8ceb63ee6c Added JIT compilation of SortDescription 2022-05-11 21:59:51 +02:00
Anton Popov
509e30698c fix checks 2022-05-11 13:37:02 +00:00
Anton Popov
1f91655cf9 support Object inside Map 2022-05-10 15:52:29 +00:00
Anton Popov
9d2a4d970d better text serialization of type Object 2022-05-09 18:05:55 +00:00
Anton Popov
e1911a29b8 better text serialization of type Object 2022-05-09 16:12:04 +00:00
Anton Popov
b3e262f605 better cloneResized in ColumnObject 2022-05-06 18:53:24 +00:00
Anton Popov
90c60741a1 more safe operations with ColumnObject 2022-05-06 17:15:05 +00:00
Anton Popov
515f68eead Merge remote-tracking branch 'upstream/master' into dynamic-columns-14 2022-05-06 16:10:51 +00:00
Anton Popov
566c08086a support Object type inside other types 2022-05-06 14:44:00 +00:00
Anton Popov
13e8db6299
Merge pull request #36762 from CurtizJ/dynamic-columns-12
Fix insertion to columns of type `Object` from multiple files
2022-05-06 14:14:32 +02:00
mergify[bot]
17aecac7ff
Merge branch 'master' into new-clangtidies 2022-05-03 19:44:01 +00:00
Robert Schulze
0a4eccb73e
Activated a bunch of LLVM 12/13/14 clang-tidy warnings
Omitted new checks which produce too many matches or which are
controversial (e.g. readability-identifier-length).

New checks:

- misc-misleading-bidirectional + misc-misleading-identifier

  Detects potential attack as described in the Trojan Source attack

- modernize-macro-to-enum

  Replaces groups of adjacent macros with an unscoped anonymous enum

- modernize-shrink-to-fit

  Replace copy and swap tricks on shrinkable containers with the
  shrink_to_fit() method call

- modernize-use-transparent-functors

  Prefer transparent functors to non-transparent ones

- modernize-use-uncaught-exceptions

  This check will warn on calls to std::uncaught_exception and replace
  them with calls to std::uncaught_exceptions (uncaught_exception was
  deprecated with C++17)

- performance-no-int-to-ptr

  Diagnoses every integer to pointer cast

- readability-duplicate-include

  Looks for duplicate includes and removes them

- readability-redundant-preprocessor

  Finds potentially redundant preprocessor directives

- bugprone-lambda-function-name

  Checks for attempts to get the name of a function from within a lambda
  expression

- bugprone-redundant-branch-condition

  Finds condition variables in nested if statements that were also
  checked in the outer if statement and were not changed

- bugprone-shared-ptr-array-mismatch

  Finds initializations of C++ shared pointers to non-array type that
  are initialized with an array

- bugprone-stringview-nullptr

  Checks for various ways that the const CharT* constructor of
  std::basic_string_view can be passed a null argument and replaces them
  with the default constructor in most cases

- bugprone-suspicious-memory-comparison

  Finds potentially incorrect calls to memcmp() based on properties of
  the arguments
2022-05-03 09:22:11 +02:00
Dmitry Novik
9be17ef50c
Merge pull request #35111 from azat/optimize_aggregation_in_order-prefix
Implement partial GROUP BY key for optimize_aggregation_in_order
2022-05-02 17:49:48 +02:00
Alexey Milovidov
b79c6cef84
Merge pull request #36756 from CurtizJ/type-json-bool
Deduce `UInt8` type for bools from json instead of `UInt64`
2022-05-01 13:51:28 +03:00
Anton Popov
243315b826 fix insert to Object columns 2022-04-29 17:26:05 +00:00
Azat Khuzhin
767acd53fb Add ability to pass range of rows to Aggregator
v2: fix compiled aggregate functions (seek result to row_start)
v3: fix compiled aggregate functions (seek args to row_start)
v4: change signatures for JIT
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-04-29 06:57:55 +03:00
Anton Popov
1fc51e09ff fix insertion to column of type Object from multiple files via table function 2022-04-28 18:51:13 +00:00
mergify[bot]
20e2fa9b3f
Merge branch 'master' into dynamic-columns-9 2022-04-28 17:53:03 +00:00
Anton Popov
54f074e104 deduce UInt8 type for bools from json instead of UInt64 2022-04-28 15:30:43 +00:00
Anton Popov
a87f19b493 fix more cases with nested arrays 2022-04-21 14:57:12 +00:00
Maksim Kita
57444fc7d3
Merge pull request #36444 from rschu1ze/clang-tidy-fixes
Clang tidy fixes
2022-04-21 16:11:27 +02:00
Robert Schulze
b24ca8de52
Fix various clang-tidy warnings
When I tried to add cool new clang-tidy 14 warnings, I noticed that the
current clang-tidy settings already produce a ton of warnings. This
commit addresses many of these. Almost all of them were non-critical,
i.e. C vs. C++ style casts.
2022-04-20 10:29:05 +02:00
Antonio Andelic
bbb0be6a44
Merge pull request #36402 from rschu1ze/clang-tidy-contains
Activate clang-tidy warning "readability-container-contains"
2022-04-20 08:15:46 +02:00
Robert Schulze
118e94523c
Activate clang-tidy warning "readability-container-contains"
This check suggests replacing <Container>.count() by
<Container>.contains() which is more speaking and in case of
multimaps/multisets also faster.
2022-04-18 23:53:11 +02:00
Alexey Milovidov
c23e451b04 Add nodiscard attribute to immutable methods of IColumn to avoid errors 2022-04-18 04:22:40 +02:00
Anton Popov
3fce23357c fix insertion of complex json with nested arrays 2022-04-08 14:58:02 +00:00
Maksim Kita
61212635d8 MergeTree multiple ORDER BY columns improve insert performance 2022-03-30 16:03:36 +02:00
Azat Khuzhin
a847b71611 Fix SubcolumnsTree declaration
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-03-26 23:42:46 +03:00
Kruglov Pavel
9ae52910f0
Fix style 2022-03-23 23:15:07 +01:00
Kruglov Pavel
c4713a9159
Update MaskOperations.cpp 2022-03-23 11:39:38 +01:00
Kruglov Pavel
9bf1cb6636
Fix 2022-03-22 20:15:05 +01:00
Kruglov Pavel
763a80e405
Add more validations in mask operations 2022-03-22 18:46:59 +01:00
Maksim Kita
d24795405c Fixed tests 2022-03-22 15:12:43 +01:00
Maksim Kita
fcbf97ba68 Fix crash during short circuit function evaluation 2022-03-22 14:10:47 +01:00
Maksim Kita
695b1300f9
Merge pull request #35383 from rschu1ze/enable-if-to-concepts-pt2
Replace more uses of std::enable_if for SFINAE by concepts
2022-03-21 10:47:28 +01:00
Anton Popov
d26ba35c2d fix race in Object type and improve performance of inserts 2022-03-19 00:26:39 +00:00
Anton Popov
b0316c1a7a better performance of inserts to Object type 2022-03-17 22:25:44 +00:00
Robert Schulze
df73c75456
Replace more uses of std::enable_if for SFINAE by concepts
- enable_if is usually regarded as fragile and unreadable
- C++20 concepts are much easier to read and produce more expressive error messages

- this is follow-up to PR #35347 but this time most of the remaining and
  more complex usages of enable_if in the codebase were replaced.
2022-03-17 20:44:55 +01:00
Anton Popov
de2cc23e15 fix race 2022-03-16 20:16:59 +00:00
Anton Popov
0ba78c3c3a Merge remote-tracking branch 'upstream/master' into HEAD 2022-03-16 15:28:09 +00:00
Maksim Kita
07b0845110 Fix clang-tidy warnings in Backups, Client, Columns folders 2022-03-14 18:17:35 +00:00
Anton Popov
063917786e minor fixes 2022-03-14 17:29:18 +00:00
Anton Popov
36ec379aeb Merge remote-tracking branch 'upstream/master' into HEAD 2022-03-14 16:28:35 +00:00
Antonio Andelic
ed3d71d83f
Merge pull request #35072 from azat/buffer-memory-tracker-leak
Avoid MEMORY_LIMIT_EXCEEDED during INSERT into Buffer with AggregateFunction
2022-03-14 12:31:04 +01:00
Azat Khuzhin
19be9c8c64 Add a comment for ColumnAggregateFunction::force_data_ownership
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-03-13 23:28:38 +03:00
Maksim Kita
b67f756a43 Fixed performance tests 2022-03-12 18:04:08 +00:00
Maksim Kita
f1d2f2a9e1 Updated tests 2022-03-11 21:16:25 +00:00
Maksim Kita
e5b85953e8 Added unit tests 2022-03-10 21:45:31 +00:00
Maksim Kita
6b916c7bb5 Fixed tests 2022-03-10 21:45:31 +00:00
Maksim Kita
5b2be4d3b8 Fixed tests 2022-03-10 21:45:31 +00:00
Maksim Kita
cbe059f4bd Updated IColumn interface to support getting stable permutation 2022-03-10 21:45:31 +00:00
Anton Popov
37efe2ddb5
Apply suggestions from code review
Co-authored-by: Kseniia Sumarokova <54203879+kssenii@users.noreply.github.com>
2022-03-10 22:24:19 +01:00
Azat Khuzhin
4118b065e6 Export IColumn::ensureOwnership() interface
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-03-09 10:57:49 +03:00
Anton Popov
0bc57da238 Merge remote-tracking branch 'upstream/master' into HEAD 2022-03-07 14:46:08 +00:00
Anton Popov
df3b07fe7c Merge remote-tracking branch 'upstream/master' into HEAD 2022-03-03 22:25:28 +00:00
Anton Popov
76e40e4f22 fix msan 2022-03-03 21:50:36 +00:00
hexiaoting
e953e482ec
Implement more functions for Map data type 2022-03-03 13:22:44 +00:00
Maksim Kita
b1a956c5f1 clang-tidy check performance-move-const-arg fix 2022-03-02 18:15:27 +00:00
Anton Popov
04a3a10148 minor fixes 2022-03-01 20:20:53 +03:00
Anton Popov
fcdebea925 Merge remote-tracking branch 'upstream/master' into HEAD 2022-02-25 13:41:30 +03:00
Anton Popov
0a7895ebb9 add comments and small refactoring 2022-02-17 22:00:25 +03:00
Anton Popov
edd686e1d9 fix unit test 2022-02-16 17:18:03 +03:00
Anton Popov
a661eaf39f better performance of getting storage snapshot 2022-02-16 02:17:22 +03:00
Anton Popov
7cddae1351 return back result_size_hint 2022-02-15 15:12:25 +03:00
Anton Popov
c18ab88706
Update src/Columns/FilterDescription.h
Co-authored-by: Vladimir C <vdimir@clickhouse.com>
2022-02-15 14:39:09 +03:00
Anton Popov
5c316ffabe support filtering by sparse columns without convertion to full 2022-02-15 14:30:54 +03:00
Anton Popov
8e26cfbbea add test with github events for type JSON 2022-02-14 22:20:52 +03:00
Rajkumar
b6a1a13327 clang-tidy reported nested_column already moved to data 2022-02-09 11:36:31 -08:00
Anton Popov
836a348a9c Merge remote-tracking branch 'upstream/master' into HEAD 2022-02-01 15:23:07 +03:00
Anton Popov
aab6ef60b2 better performance of parsing json data 2022-02-01 14:17:29 +03:00
Maksim Kita
241c395329 Fixed style check 2022-01-31 09:12:08 +00:00
Maksim Kita
5ef83deaa6 Update sort to pdqsort 2022-01-30 19:49:48 +00:00
Anton Popov
78b9f15abb Merge remote-tracking branch 'upstream/master' into HEAD 2022-01-30 03:24:37 +03:00
Maksim Kita
1eacd7a00c pdqsort performance check 2022-01-29 21:47:32 +00:00
Azat Khuzhin
9766619b55 Headers cleanup in ColumnMap
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-29 12:32:25 +03:00
Azat Khuzhin
f88ab143c4 Headers cleanup in ColumnArray
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-29 12:32:15 +03:00
Azat Khuzhin
3bc10871eb Minor cleanup in ColumnTuple
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-29 12:30:31 +03:00
Azat Khuzhin
b511abb72c Use reserve() over resize() for Map
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-29 12:29:13 +03:00
Azat Khuzhin
9e740eb9d0 Use reserve() over resize() for Tuple
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-29 12:29:13 +03:00
Azat Khuzhin
097bd6b7e8 Simplify ColumnArray::operator[] using ColumnArray::get()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-29 12:28:32 +03:00
Maksim Kita
e2de0dff8f
Merge pull request #34074 from azat/array-optimization
Slightly optimize ColumnArray::get()/operator[] (by using reserve over resize)
2022-01-28 16:09:44 +01:00
Azat Khuzhin
4e07122079 Slightly optimize ColumnArray::get()/operator[] (by using reserve over resize)
Note, that simple "SELECT range(100)" will execute
ColumnArray::operator[] 14 times (most of them from
DB::checkColumnStructure())

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-01-28 08:08:14 +03:00
Maksim Kita
af5ad2f370 Remove DecimalPaddedPODArray 2022-01-27 10:07:53 +00:00
Anton Popov
90b74c2aeb better unflattenTuple 2022-01-27 03:24:34 +03:00
Anton Popov
e8ce091e68 Merge remote-tracking branch 'upstream/master' into HEAD 2022-01-21 20:11:18 +03:00
Anton Popov
751d9e6a44 support nested in json type (wip) 2022-01-21 17:58:21 +03:00
Maksim Kita
6b9a5ab15e TypeId name fix 2022-01-20 13:51:00 +00:00
Alexey Milovidov
56b25f4543 Review fixes 2022-01-17 04:14:16 +03:00
Alexey Milovidov
7848ea7d60 Allow insertFrom for ColumnFunction 2022-01-16 06:18:35 +03:00
Anton Popov
aa515b7126 support nested in json type (wip) 2021-12-23 15:28:40 +03:00
Raúl Marín
88b8fd8b60 Merge remote-tracking branch 'blessed/master' into libcxx13_take2 2021-12-23 09:16:19 +01:00
Dmitry Novik
38c1e81752 fixup 2021-12-21 22:00:08 +03:00
Dmitry Novik
56917ca0ff Fix WriteBuffer initialization 2021-12-21 18:49:20 +03:00
mergify[bot]
7da6d8b310
Merge branch 'master' into fix_IP_conversion 2021-12-21 12:16:05 +00:00
Raúl Marín
36164a72c2 Missing include 2021-12-20 18:17:10 +01:00
Maksim Kita
20e4ce3314 Short circuit evaluation function throwIf support 2021-12-20 14:49:05 +03:00
mergify[bot]
4580af9f79
Merge branch 'master' into fix_segfault_object_used_after_move 2021-12-19 04:33:03 +00:00
N. Kolotov
b059154a81 Fixed segfault when smart pointer is dereferenced after move. 2021-12-18 23:13:42 +03:00
Anton Popov
99ebabd822 Merge remote-tracking branch 'upstream/master' into HEAD 2021-12-17 19:02:29 +03:00
Anton Popov
a70e5c1b2d support nested in json type (wip) 2021-12-17 18:08:34 +03:00
Anton Popov
079b08a28a support nested in json type (wip) 2021-12-16 14:42:12 +03:00
mergify[bot]
4300f77532
Merge branch 'master' into fix_IP_conversion 2021-12-14 20:12:34 +00:00
Anton Popov
ea67abf3f0 fix custom serializations in native protocol 2021-12-08 21:59:36 +03:00
Anton Popov
d8367334a3 Merge remote-tracking branch 'upstream/master' into HEAD 2021-12-08 18:26:19 +03:00
Azat Khuzhin
2b1789adc5 Pass through version for aggregate function from SerializationAggregateFunction too
Suggested-by: @kssenii
2021-12-05 21:45:07 +03:00
Azat Khuzhin
428e34d811 Fix versioning of aggregate functions (fixes performance tests) 2021-12-05 21:45:07 +03:00
Anton Popov
6f4d9a53b2 Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-12-01 15:54:33 +03:00
Anton Popov
54f51444c0 Merge remote-tracking branch 'upstream/master' into HEAD 2021-12-01 15:49:02 +03:00
Anton Popov
63fceca6a8 support nested in json type (wip) 2021-12-01 05:59:56 +03:00
kssenii
be3b4ca8fe Merge branch 'master' of github.com:ClickHouse/ClickHouse into versioning 2021-11-27 09:44:31 +00:00
alexey-milovidov
423d497b27
Merge pull request #31742 from CurtizJ/fix-map
Fix usage of `Buffer` table engine with type `Map`
2021-11-25 04:56:37 +03:00
Anton Popov
37350e007c fix mutate of ColumnMap 2021-11-25 00:05:08 +03:00
Anton Popov
ccd78e3838 Merge remote-tracking branch 'upstream/master' into HEAD 2021-11-22 17:19:35 +03:00
mergify[bot]
a7ba3e23a0
Merge branch 'master' into fix-write-buffers 2021-11-22 11:24:27 +00:00
Alexey Milovidov
e898c6608c Fix broken non-x86 builds 2021-11-20 15:58:44 +03:00
kssenii
37f482d478 Merge branch 'master' of github.com:ClickHouse/ClickHouse into versioning 2021-11-15 07:31:11 +00:00
avogar
c521a9131a Small refactoring of WriteBiffer-s 2021-11-11 02:11:18 +03:00
Anton Popov
a20922b2d3 Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-11-09 15:36:25 +03:00
mergify[bot]
4f6fd49266
Merge branch 'master' into fix_IP_conversion 2021-11-09 12:11:54 +00:00
Anton Popov
a7f219b3aa better sampling in ColumnSparse and fix alter rename column 2021-11-08 21:25:31 +03:00
Anton Popov
84e914e05a minor fixes near serializations 2021-11-05 01:46:00 +03:00
Anton Popov
46fa062a81 fix tests 2021-11-02 23:30:28 +03:00
Anton Popov
d50137013c Merge remote-tracking branch 'upstream/master' into HEAD 2021-11-01 16:55:53 +03:00
Anton Popov
0099dfd523 refactoring of SerializationInfo 2021-10-29 20:21:02 +03:00
alexey-milovidov
69bc2a8d2a
Merge pull request #30780 from ClickHouse/remove-cruft
Remove cruft
2021-10-28 17:42:18 +03:00
Alexey Milovidov
8b4a6a2416 Remove cruft 2021-10-28 02:10:39 +03:00
jasperzhu
49dd69c6c9 adjust header files 2021-10-27 05:22:05 +05:30
jasperzhu
0217ed09ac revise compile flag 2021-10-27 05:19:15 +05:30
jasperzhu
5ab55f7eaa fixed function defect 2021-10-27 04:21:46 +05:30
jasperzhu
27f30dab89 remove function due to extra latency 2021-10-27 03:44:28 +05:30
jasperzhu
fb31410926 change to inline for bitmask generator 2021-10-27 00:05:47 +05:30
jasperzhu
1caff8a81c fixed compile error 2021-10-26 22:12:21 +05:30
jasperzhu
911b9c3973 Improve function defect 2021-10-26 06:02:57 +05:30
jasperzhu
3d115536f5 Improve filter bitmask generator function all in one with sse/avx2/avx512 2021-10-26 01:39:09 +05:30
Maksim Kita
243be5028a
Merge pull request #30014 from jinjunzh/master
add x86 feature avx2/avx512 support for accelerating filter operation
2021-10-22 14:16:47 +03:00
vesslanjin
f607a5d0ab remove branch in ColumnDecimal, same as pull req #29881
Co-authored-by: Zhu Jasper jasper.zhu@intel.com

Signed-off-by: vesslanjin <jun.i.jin@intel.com>
2021-10-20 07:40:06 -04:00
Anton Popov
d71ffc355a Merge remote-tracking branch 'upstream/master' into HEAD 2021-10-18 15:18:22 +03:00
Anton Popov
e46396331d better permute in ColumnSparse 2021-10-14 20:28:31 +03:00
Anton Popov
7aa6068fb2 Merge remote-tracking branch 'upstream/master' into HEAD 2021-10-14 19:44:08 +03:00
jasperzhu
f08dd0e8d8 modify flags definitions 2021-10-13 05:13:34 +05:30
jasperzhu
a1ab3b6606 Fixed code style issue 2021-10-12 22:44:37 +05:30
jasperzhu
8f349907fb Fixed trailing whitespaces issue 2021-10-12 09:21:54 +05:30
jasperzhu
3be83a26d0 fixed Typos and Styles issues 2021-10-12 08:24:47 +05:30
jasperzhu
0ef2624408 add specific flags for compiling filter operation source files 2021-10-12 04:04:27 +05:30
jasperzhu
a3d629a5b5 add x86 feature avx2/avx512 support for filter implementation 2021-10-11 22:51:13 +05:30
Nikolai Kochetov
a95c28ec4b
Merge pull request #29898 from ClickHouse/remove-native-stream
Remove some more streams.
2021-10-10 21:01:16 +03:00
Vladimir C
3940382c2f
Remove defined(__POPCNT__) from column filter 2021-10-09 13:34:02 +03:00
vesslanjin
bed09ee68d Whitespace fix
Signed-off-by: vesslanjin <jun.i.jin@intel.com>
2021-10-09 02:56:10 -04:00
vesslanjin
75af011068 use while instead of popcnt + for
Co-authored-by: Zhu Jasper jasper.zhu@intel.com
2021-10-08 14:58:23 -04:00
Nikolai Kochetov
340b53ef85 Remove some more streams. 2021-10-08 17:03:54 +03:00
Vladimir C
525df99893
Whitespace fix 2021-10-08 12:10:19 +03:00
Vladimir C
35feb08236
Whitespace changes 2021-10-08 12:03:55 +03:00
vesslanjin
383f3a3a20 Remove branchy code in filter operation with a better implementation with popcnt/ctz which have better performance
Co-authored-by: Zhu Jasper <jasper.zhu@intel.com>
2021-10-08 09:19:58 -04:00
Nikolai Kochetov
25e2ebac75
Merge pull request #29782 from azat/lc-concurrent-GROUP-BY-fix
Fix concurrent access to LowCardinality during GROUP BY (leads to SIGSEGV)
2021-10-07 16:27:53 +03:00
Vladimir C
4b80c6ff21
Merge pull request #29545 from CurtizJ/remove-permute 2021-10-07 11:07:34 +03:00
mergify[bot]
5b667d3cd5
Merge branch 'master' into fix_IP_conversion 2021-10-06 16:40:47 +00:00
Anton Popov
199ac31b48
Merge pull request #29683 from myrrc/improvement/tl-to-common
Non-recursive implementation for type list and its functions
2021-10-05 21:49:15 +03:00
Azat Khuzhin
342ec02664 Fix concurrent access to LowCardinality during GROUP BY (leads to SIGSEGV)
The problem is that GROUP BY can update saved_hash, which can be also
updated by subsequent update of a dictionary, and this will lead to
use-after-free.

You will find ASan report in `details`.

<details>

    ==24679==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000615d20 at pc 0x000022cc8684 bp 0x7ffea6b5f850 sp 0x7ffea6b5f848
    READ of size 8 at 0x604000615d20 thread T223 (QueryPipelineEx)
        0 0x22cc8683 in DB::ReverseIndex<>::insert(StringRef const&) obj-x86_64-linux-gnu/../src/Columns/ReverseIndex.h
        1 0x22cc0de1 in COW<DB::IColumn>::mutable_ptr<DB::IColumn> DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeImpl<char8_t>()::'lambda'()::operator()() const obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:540:39
        2 0x22cc0de1 in COW<DB::IColumn>::mutable_ptr<DB::IColumn> DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeImpl<char8_t>() obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:570:23
        3 0x22cb9c66 in COW<DB::IColumn>::mutable_ptr<DB::IColumn> DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeFrom()::'lambda'(auto)::operator()<char8_t>(auto) const obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:592:26
        4 0x22cb9c66 in DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeFrom() obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:600:28
        5 0x2500b897 in DB::ColumnLowCardinality::insertRangeFrom() obj-x86_64-linux-gnu/../src/Columns/ColumnLowCardinality.cpp:205:62
        6 0x25a182f4 in DB::appendBlock(DB::Block const&, DB::Block&) obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:470:23
        7 0x25a182f4 in DB::BufferSink::insertIntoBuffer(DB::Block const&, DB::StorageBuffer::Buffer&) obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:634:9
        8 0x25a173cc in DB::BufferSink::consume(DB::Chunk) obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:595:9
        9 0x26d1c997 in DB::SinkToStorage::transform(DB::Chunk&) obj-x86_64-linux-gnu/../src/Processors/Sinks/SinkToStorage.cpp:18:5

    0x604000615d20 is located 16 bytes inside of 40-byte region [0x604000615d10,0x604000615d38)
    freed by thread T37 (QueryPipelineEx) here:
        2 0x22cb9392 in boost::intrusive_ptr<DB::ColumnVector<unsigned long> >::~intrusive_ptr() obj-x86_64-linux-gnu/../contrib/boost/boost/smart_ptr/intrusive_ptr.hpp:98:23
        4 0x22cb9392 in COW<DB::IColumn>::mutable_ptr<DB::ColumnVector<unsigned long> >::operator=() obj-x86_64-linux-gnu/../src/Common/COW.h💯57
        5 0x22cb9392 in DB::ReverseIndex<>::tryGetSavedHash() const obj-x86_64-linux-gnu/../src/Columns/ReverseIndex.h:362:28
        6 0x22cb9392 in DB::ColumnUnique<DB::ColumnString>::tryGetSavedHash() const obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:125:76
        7 0x242eaed3 in DB::ColumnsHashing::HashMethodSingleLowCardinalityColumn<>::HashMethodSingleLowCardinalityColumn() obj-x86_64-linux-gnu/../src/Common/ColumnsHashing.h:287:50
        8 0x242206c6 in void DB::Aggregator::executeImpl<>() const obj-x86_64-linux-gnu/../src/Interpreters/Aggregator.cpp:596:28
        9 0x24148e99 in DB::Aggregator::executeOnBlock() const obj-x86_64-linux-gnu/../src/Interpreters/Aggregator.cpp:1004:9
        10 0x26c24f3a in DB::AggregatingTransform::consume(DB::Chunk) obj-x86_64-linux-gnu/../src/Processors/Transforms/AggregatingTransform.cpp:539:33
        11 0x26c2054e in DB::AggregatingTransform::work() obj-x86_64-linux-gnu/../src/Processors/Transforms/AggregatingTransform.cpp:500:9

    previously allocated by thread T37 (QueryPipelineEx) here:
        0 0xb6d44fd in operator new(unsigned long) (/src/ch/tmp/upstream/clickhouse-asan+0xb6d44fd)
        1 0x11b78580 in COW<DB::IColumn>::mutable_ptr<> COWHelper<>::create<unsigned long&>(unsigned long&) (/src/ch/tmp/upstream/clickhouse-asan+0x11b78580)
        2 0x22cbf7b1 in DB::ReverseIndex<>::calcHashes() const obj-x86_64-linux-gnu/../src/Columns/ReverseIndex.h:472:17
        3 0x22cc2307 in DB::ReverseIndex<>::buildIndex() obj-x86_64-linux-gnu/../src/Columns/ReverseIndex.h:438:22
        4 0x22cc658c in DB::ReverseIndex<>::insert(StringRef const&) obj-x86_64-linux-gnu/../src/Columns/ReverseIndex.h:484:9
        5 0x22cc0de1 in COW<DB::IColumn>::mutable_ptr<DB::IColumn> DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeImpl<char8_t>()::'lambda'()::operator()() const obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:540:39
        6 0x22cc0de1 in COW<DB::IColumn>::mutable_ptr<DB::IColumn> DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeImpl<char8_t>() obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:570:23
        7 0x22cb9c66 in COW<DB::IColumn>::mutable_ptr<DB::IColumn> DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeFrom()::'lambda'(auto)::operator()<char8_t>(auto) const obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:592:26
        8 0x22cb9c66 in DB::ColumnUnique<DB::ColumnString>::uniqueInsertRangeFrom() obj-x86_64-linux-gnu/../src/Columns/ColumnUnique.h:600:28
        9 0x2500b897 in DB::ColumnLowCardinality::insertRangeFrom() obj-x86_64-linux-gnu/../src/Columns/ColumnLowCardinality.cpp:205:62
        10 0x25a182f4 in DB::appendBlock(DB::Block const&, DB::Block&) obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:470:23
        11 0x25a182f4 in DB::BufferSink::insertIntoBuffer(DB::Block const&, DB::StorageBuffer::Buffer&) obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:634:9
        12 0x25a173cc in DB::BufferSink::consume(DB::Chunk) obj-x86_64-linux-gnu/../src/Storages/StorageBuffer.cpp:595:9
        13 0x26d1c997 in DB::SinkToStorage::transform(DB::Chunk&) obj-x86_64-linux-gnu/../src/Processors/Sinks/SinkToStorage.cpp:18:5

    SUMMARY: AddressSanitizer: heap-use-after-free obj-x86_64-linux-gnu/../src/Columns/ReverseIndex.h in DB::ReverseIndex<unsigned long, DB::ColumnString>::insert(StringRef const&)
    Shadow bytes around the buggy address:
      0x0c08800bab50: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 00
      0x0c08800bab60: fa fa fd fd fd fd fd fa fa fa 00 00 00 00 00 fa
      0x0c08800bab70: fa fa 00 00 00 00 00 00 fa fa 00 00 00 00 00 00
      0x0c08800bab80: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fa
      0x0c08800bab90: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fd
    =>0x0c08800baba0: fa fa fd fd[fd]fd fd fa fa fa fd fd fd fd fd fa
      0x0c08800babb0: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fa
      0x0c08800babc0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fd
      0x0c08800babd0: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fa
      0x0c08800babe0: fa fa fd fd fd fd fd fa fa fa fd fd fd fd fd fd
      0x0c08800babf0: fa fa fd fd fd fd fd fd fa fa fd fd fd fd fd fd
    Shadow byte legend (one shadow byte represents 8 application bytes):
      Addressable:           00
      Partially addressable: 01 02 03 04 05 06 07
      Heap left redzone:       fa
      Freed heap region:       fd
      Stack left redzone:      f1
      Stack mid redzone:       f2
      Stack right redzone:     f3
      Stack after return:      f5
      Stack use after scope:   f8
      Global redzone:          f9
      Global init order:       f6
      Poisoned by user:        f7
      Container overflow:      fc
      Array cookie:            ac
      Intra object redzone:    bb
      ASan internal:           fe
      Left alloca redzone:     ca
      Right alloca redzone:    cb
    ==24679==ABORTING

</details>
2021-10-05 21:07:10 +03:00
Anton Popov
b5098301d6 fix build 2021-10-05 18:23:53 +03:00
Anton Popov
cd08057285 better arguments 2021-10-04 15:02:11 +03:00
Mike Kot
8c8bada56e Non-recursive implementation for TL and its functions 2021-10-03 18:02:04 +02:00
Anton Popov
857b8f0b1d fix clang-tidy 2021-10-02 22:36:30 +03:00
Anton Popov
1f10246a10 Merge remote-tracking branch 'upstream/master' into HEAD 2021-10-02 22:33:27 +03:00
Alexey Milovidov
fe6b7c77c7 Rename "common" to "base" 2021-10-02 10:13:14 +03:00
Anton Popov
9c296e94f3 fix performance of updatePermutation 2021-10-01 19:45:17 +03:00
Anton Popov
515cc74530 generalize code in IColumn::updatePermutation 2021-10-01 00:11:54 +03:00
Anton Popov
0dfe96fc02 generalize code in IColumn::permute 2021-09-29 20:56:10 +03:00
Dmitry Novik
abdd8fb516 Cleanup 2021-09-29 19:42:41 +03:00
Anton Popov
914781052e Merge remote-tracking branch 'upstream/master' into HEAD 2021-09-29 17:37:07 +03:00
Anton Popov
dc94d2239e better ColumnSparse 2021-09-29 17:18:41 +03:00
Dmitry Novik
95193e06f6 Remove empty row creation 2021-09-28 16:59:58 +03:00
mergify[bot]
86eb589c72
Merge branch 'master' into fix_IP_conversion 2021-09-27 14:41:56 +00:00
alexey-milovidov
e4363872ca
Merge branch 'master' into yandex-to-clickhouse-in-configs 2021-09-25 19:58:36 +03:00
Alexey Milovidov
cd7f9d981c Remove ya.make 2021-09-25 04:22:54 +03:00
Alexey Milovidov
e9e77b4403 .tech -> .com 2021-09-22 03:22:57 +03:00
Dmitry Novik
9049fd701f Refactor ColumnStringHelpers 2021-09-21 17:27:34 +03:00
Vasily Nemkov
175b94fa2d Special case of conversion code for types with custom serialization/deserialization
Fixes CASTing from String or FixedString to IPv4 or IPv6 and back.
2021-09-21 15:34:06 +03:00
Anton Popov
eef436fe22 Merge remote-tracking branch 'upstream/master' into HEAD 2021-09-16 18:07:42 +03:00
Anton Popov
348537faee better IColumn::createWithOffsets 2021-09-16 16:57:45 +03:00
Anton Popov
3adc2a9aea fix distinct with sparse columns 2021-09-16 15:52:59 +03:00
Anton Popov
b0c0b2bc10 fix some builds 2021-09-14 19:33:00 +03:00
Anton Popov
d09f973b83 dynamic columns: fix several cases of parsing json 2021-09-13 17:02:38 +03:00
Sergei Semin
12e24a23d3
Merge branch 'master' into fix-build-clang-13-2 2021-09-12 19:30:55 +03:00
alexey-milovidov
60f76d9254
Merge pull request #28759 from nikitamikhaylov/enable-gcc-11
Switch CI to GCC-11
2021-09-12 15:56:57 +03:00
alexey-milovidov
ea13a8b562
Merge pull request #28659 from myrrc/improvement/tostring_to_magic_enum
Improving CH type system with concepts
2021-09-12 15:26:29 +03:00
Sergei Semin
f74350c148 fix special build 2021-09-12 02:49:31 +03:00
Mike Kot
3401b32e37 Adapted usage of is_decimal concept 2021-09-11 19:35:12 +02:00