Commit Graph

1366 Commits

Author SHA1 Message Date
Kruglov Pavel
e981b2e78b
Merge pull request #43813 from Avogar/fix-sum-if
Better handling of NULL in aggregate combinators, fix possible segfault/logical error
2022-12-27 16:50:48 +01:00
Alexey Milovidov
4ce9732502
Update AggregateFunctionSumMap.h 2022-12-27 17:15:48 +03:00
Alexey Milovidov
611bb44288
Merge branch 'master' into fix-30975 2022-12-27 17:15:12 +03:00
Raúl Marín
948ce8db93 Revert "Merge pull request #38953 from ClickHouse/add-allocation-ptr-to-trace-log"
This reverts commit e99849d031, reversing
changes made to 7ad3ff8a9e.
2022-12-27 14:28:13 +01:00
Duc Canh Le
d65f23b2f6 update frame in-place 2022-12-27 19:24:59 +08:00
Duc Canh Le
c315ed354c Merge branch 'master' into ch_canh_fix_sparkbar 2022-12-27 17:50:19 +08:00
Bharat Nallan Chakravarthy
cda37e73ba fix test failure 2022-12-26 09:05:21 -08:00
Alexey Milovidov
71633bd341
Update AggregateFunctionSparkbar.h 2022-12-24 05:14:50 +03:00
Dmitry Novik
e481c0bae5 Cleanup code 2022-12-23 18:23:01 +00:00
Duc Canh Le
da14883715 fix spark bar OOM 2022-12-21 22:17:09 +08:00
Dmitry Novik
51ba12ca0d Fix ubsan failures 2022-12-20 17:10:27 +00:00
avogar
00be9639f7 Fix compiled functions 2022-12-20 15:21:41 +00:00
Alexey Milovidov
8b6092b321 Fix support for complex parameters of parametric aggregate functions, #30975 2022-12-19 07:26:54 +01:00
avogar
22e70fa71e Try fix tests 2022-12-16 18:09:42 +00:00
Dmitry Novik
f725ec9a73 Update AggregateFunctionFlameGraph 2022-12-16 16:18:11 +00:00
Dmitry Novik
875a24a650 Merge remote-tracking branch 'origin/master' into refector-function-node 2022-12-16 16:07:30 +00:00
avogar
3f17d05a30 Merge branch 'master' of github.com:ClickHouse/ClickHouse into fix-sum-if 2022-12-16 14:47:07 +00:00
Nikolai Kochetov
e99849d031
Merge pull request #38953 from ClickHouse/add-allocation-ptr-to-trace-log
Track allocation ptr in system.trace_log. Add aggregate function flamegraph
2022-12-15 18:16:05 +01:00
Bharat Nallan Chakravarthy
aa03712b6d fix build failure 2022-12-14 23:49:51 -08:00
Bharat Nallan Chakravarthy
e4023b3b90 Merge remote-tracking branch 'upstream/master' into ncb/weighted-quantile-approx 2022-12-13 09:34:26 -08:00
Dmitry Novik
3d2fccab87
Merge branch 'master' into refector-function-node 2022-12-12 21:36:39 +01:00
Nikolai Kochetov
e451137040 Add comments. 2022-12-12 18:26:07 +00:00
Alexey Milovidov
bca18298a1
Merge pull request #44067 from ClickHouse/fix-quantiles-msan
Fix undefined behavior in `quantiles` function
2022-12-12 04:19:00 +03:00
Alexey Milovidov
80cb90dac1
Merge pull request #44091 from ClickHouse/fix_44084
Fix another bug in AggregateFunctionMinMaxAny
2022-12-11 07:49:56 +03:00
Alexey Milovidov
0acadc6724 Fix one more UB 2022-12-11 04:29:06 +01:00
Nikolai Kochetov
d27f61b4a2 Fix style. 2022-12-09 19:54:21 +00:00
Nikolai Kochetov
9cbae9e977 Fix style. 2022-12-09 18:55:52 +00:00
Alexander Tokmakov
e9fa1accf1 fix another bug in AggregateFunctionMinMaxAny 2022-12-09 17:32:28 +01:00
Alexey Milovidov
6f69200662 Fix undefined behavior in quantiles function 2022-12-09 04:17:54 +01:00
Dmitry Novik
36ad3fd7a0
Merge pull request #43763 from ClickHouse/fix-null-variadic
Fix included_elements calculation in AggregateFunctionNullVariadic
2022-12-08 18:41:05 +01:00
Dmitry Novik
25ecb75ca8 Merge remote-tracking branch 'origin/master' into refector-function-node 2022-12-07 18:36:50 +00:00
Nikolai Kochetov
9a4b3493fd Merge branch 'master' into add-allocation-ptr-to-trace-log 2022-12-06 17:09:54 +01:00
zhanglistar
dae51c7a00
Merge branch 'master' into constexpr 2022-12-05 10:09:58 +08:00
Dmitry Novik
6bc152c7a0 Fix AggregateFunctionForEach result type 2022-12-02 19:15:26 +00:00
Dmitry Novik
15b8c48ca9 Cleanup code 2022-12-02 19:15:26 +00:00
Dmitry Novik
4d5868d05d Fix AggregateFunctionMerge 2022-12-02 19:15:26 +00:00
Dmitry Novik
e6c283e7df Fix AggregateFunctionMinMaxAny::createResultType 2022-12-02 19:15:26 +00:00
Dmitry Novik
48e8aeac01 Clean up code 2022-12-02 19:15:26 +00:00
Dmitry Novik
2c70dbc76a Refactor FunctionNode 2022-12-02 19:15:26 +00:00
Kruglov Pavel
c35b2a6495
Add a limit for string size in RowBinary format (#43842) 2022-12-02 13:57:11 +01:00
Kruglov Pavel
ef8781e5ff
Merge branch 'master' into fix-sum-if 2022-12-01 12:49:10 +01:00
Nikolai Kochetov
7649a3c4d7 Merge branch 'master' into add-allocation-ptr-to-trace-log 2022-12-01 12:12:23 +01:00
zhanglistar
90c832c70f
Merge branch 'master' into constexpr 2022-12-01 14:07:59 +08:00
zhanglistar
470595f3fc AggregateFunctionNullBase add constexpr 2022-12-01 12:11:59 +08:00
Alexander Tokmakov
431f6551cb
Merge branch 'master' into fix_assertion_in_thread_status 2022-11-30 23:05:15 +03:00
Dmitry Novik
ba3663e600
Merge branch 'master' into fix-null-variadic 2022-11-30 17:10:05 +01:00
zhanglistar
e40398f5b9 add constexpr on if 2022-11-30 19:55:42 +08:00
avogar
61d864f846 Remove unneded check 2022-11-29 18:20:51 +00:00
avogar
c0c976b850 Better handling of NULL in aggregate combinators, fix possible segfault/logical error while using 2022-11-29 18:19:00 +00:00
Alexander Tokmakov
e45105bf44 detach threads from thread group 2022-11-28 21:31:55 +01:00
Alexander Tokmakov
9d6e8c67da yet another fix for AggregateFunctionMinMaxAny 2022-11-28 21:11:48 +01:00
Dmitry Novik
ec3e46b471 Fix included_elements calculation in AggregateFunctionNullVariadic 2022-11-28 16:07:48 +00:00
Vladimir C
4819bc24b0
Merge pull request #43414 from azat/func/sumMap-decimal-Nullable-fix
Fixes https://github.com/ClickHouse/ClickHouse/issues/43395
2022-11-24 11:58:02 +01:00
Alexander Tokmakov
4f28334b5c fix mess with signed sizes 2022-11-22 13:57:05 +01:00
Raúl Marín
a52bdca989 Detect the other corrupted state too 2022-11-21 13:33:16 +01:00
Azat Khuzhin
6f0e042914 Fix sumMap() for Nullable(Decimal())
Fixes: #43395
Follow-up for: #20970 (cc @kitaisreal)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-11-21 09:43:21 +01:00
Alexander Tokmakov
854657d372 fix another issue 2022-11-19 23:14:53 +01:00
Alexander Tokmakov
09de30a51a fix overflow, add more tests 2022-11-19 18:58:40 +01:00
Alexander Tokmakov
9464c32bb8 Merge branch 'master' into revert_SingleValueDataString 2022-11-19 18:00:04 +01:00
Alexander Tokmakov
35f677d7d8 make read(...) compatible with buggy versions 2022-11-18 19:48:24 +01:00
Alexander Tokmakov
415eaff8d5 revert incompatible changes 2022-11-18 19:44:47 +01:00
Alexander Tokmakov
6a3b57c27d revert changes in AggregateFunctionMinMaxAny.h 2022-11-18 19:44:36 +01:00
Nikita Taranov
7beb58b0cf
Optimize merge of uniqExact without_key (#43072)
* impl for uniqExact

* rm unused (read|write)Text methods

* fix style

* small fixes

* impl for variadic uniqExact

* refactor

* fix style

* more agressive inlining

* disable if max_threads=1

* small improvements

* review fixes

* Revert "rm unused (read|write)Text methods"

This reverts commit a7e7480584.

* encapsulate is_able_to_parallelize_merge in Data

* encapsulate is_exact & argument_is_tuple in Data
2022-11-17 13:19:02 +01:00
Vladimir C
a29c5b9e3a
Merge pull request #43232 from ClickHouse/vdimir/max_map_null_totals_bug 2022-11-17 13:10:05 +01:00
Raúl Marín
78d4a4b5c2 Add a detailed comment about the change 2022-11-16 13:59:37 +01:00
Raúl Marín
4e7ccd1c06 Merge remote-tracking branch 'blessed/master' into revert_SingleValueDataString 2022-11-16 12:59:47 +01:00
Raúl Marín
d49b65cf1e Fix capacity check 2022-11-15 16:31:12 +01:00
Raúl Marín
143b67d0be Fix ubsan in AggregateFunctionMinMaxAny::read with high sizes 2022-11-15 15:40:06 +01:00
vdimir
28fec44ffc
Fix merging null values in AggregateFunctionSumMap 2022-11-14 20:56:36 +00:00
Raúl Marín
ee1a1d852d Address ubsan on readBinary with bool 2022-11-14 15:02:55 +01:00
Raúl Marín
5a3f324311 Try adding compatibility on write instead of on read 2022-11-11 18:12:34 +01:00
Raúl Marín
547cd71423 Address some sanitizer issues 2022-11-11 12:47:14 +01:00
Raúl Marín
41056bb990 Vuln WIP 2022-11-11 10:27:37 +01:00
Raúl Marín
0c5159d26c Merge remote-tracking branch 'blessed/master' into agg_memory_rails 2022-11-08 10:59:07 +01:00
Raúl Marín
a04b9fa947 Add some guard rails around aggregation memory management 2022-11-07 17:25:04 +01:00
Robert Schulze
9c066e964d
Less use of CH-specific bit_cast()
Converted usage of CH-custom bit_cast to std::bit_cast if possible, i.e.
when
  sizeof(From) == sizeof(To).
(The CH-custom bit_cast is able to deal with sizeof(From) != sizeof(To).)

Motivation for this came from #42847 where it is not clear how the
internal bit_cast should behave on big endian systems, so we better
avoid that situation as much as possible.
2022-11-04 15:52:48 +00:00
vdimir
6d798cbc9d
Add checks in AggregateFunctionAnalysisOfVariance 2022-11-03 14:22:10 +00:00
Azat Khuzhin
4e76629aaf Fixes for -Wshorten-64-to-32
- lots of static_cast
- add safe_cast
- types adjustments
  - config
  - IStorage::read/watch
  - ...
- some TODO's (to convert types in future)

P.S. That was quite a journey...

v2: fixes after rebase
v3: fix conflicts after #42308 merged
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-21 13:25:19 +02:00
Alexey Milovidov
6c31bcad0a
Merge pull request #42417 from amosbird/issue_42408
Correct implementation of AggregateState comparison
2022-10-21 01:20:50 +02:00
Nikita Mikhaylov
0d07aeec2f
Fix logical error from welchTTest (#42487) 2022-10-20 13:09:02 +02:00
Antonio Andelic
98c34159ee Use correct type for UInt128 2022-10-19 08:05:09 +00:00
Kruglov Pavel
25e13bdd2f
Merge pull request #41107 from Avogar/improve-combinators
Support all combinators combination in WindowTransform/arratReduce*/initializeAggregation/aggregate functions versioning
2022-10-18 15:24:49 +02:00
Nikita Mikhaylov
8755f94548
Added aggregate function analysisOfVariance (anova). Merging #37872 (#42131) 2022-10-18 14:57:56 +02:00
Amos Bird
6d32149fa6
Correct implementation of agg state comparison 2022-10-18 14:05:06 +08:00
avogar
52427e6028 Remove code duplication 2022-10-14 18:07:02 +00:00
Kruglov Pavel
ff11904850
Merge branch 'master' into improve-combinators 2022-10-14 17:19:31 +02:00
Maksim Kita
2f5b2d782c
Merge pull request #42063 from kitaisreal/function-name-normalization-header-functions
Function name normalization fix functions header
2022-10-09 14:19:33 +03:00
Alexander Tokmakov
bd10a9d2d4
Merge pull request #42168 from ClickHouse/unreachable_macro
Abort instead of `__builtin_unreachable` in debug builds
2022-10-08 19:05:57 +03:00
Alexander Tokmakov
4175f8cde6 abort instead of __builtin_unreachable in debug builds 2022-10-07 21:49:08 +02:00
Maksim Kita
76d6204f99 JIT compilation migration to LLVM 15 2022-10-07 10:53:38 +02:00
Maksim Kita
6ad435d034
Merge branch 'master' into function-name-normalization-header-functions 2022-10-06 13:29:21 +03:00
Robert Schulze
da5a2e2db0
Merge remote-tracking branch 'origin/master' into generated-file-cleanup
Physical merge conflicts:
- src/Common/ZooKeeper/ZooKeeperImpl.cpp
- src/Core/config_core.h.in
- src/Functions/FunctionsAES.h
- src/Functions/config_functions.h.in
- src/configure_config.cmake

Logical merge conflicts:
- Functions/tryDecrypt.cpp
2022-10-06 08:43:25 +00:00
Maksim Kita
f4101861e7 Function name normalization fix functions header 2022-10-04 17:29:33 +02:00
Duc Canh Le
369f084070
Update src/AggregateFunctions/AggregateFunctionRankCorrelation.h
Co-authored-by: Nikolay Degterinsky <43110995+evillique@users.noreply.github.com>
2022-10-03 20:15:31 +08:00
Duc Canh Le
fad6af40cd
Merge branch 'master' into ch_canh_fix_rankcorr 2022-10-03 19:57:51 +08:00
Duc Canh Le
34f598e09b fix rankcorr size overflow 2022-10-03 19:55:37 +08:00
Robert Schulze
5273280ba4
Fix build 2022-09-30 12:36:22 +00:00
Robert Schulze
cc92a2d174
Merge branch 'master' into generated-file-cleanup 2022-09-30 09:56:31 +02:00
Robert Schulze
fd86829824
Consolidate config_core.h into config.h
Less duplication, less confusion ...
2022-09-28 13:31:57 +00:00
Robert Schulze
78fc36ca49
Generate config.h into ${CONFIG_INCLUDE_PATH}
This makes the target location consistent with other auto-generated
files like config_formats.h, config_core.h, and config_functions.h and
simplifies the build of clickhouse_common.
2022-09-28 12:48:26 +00:00
Robert Schulze
a5311fb976
Fix tests (hopefully), pt. II 2022-09-27 08:07:42 +00:00
Kruglov Pavel
3dc54272ed
Merge branch 'master' into improve-combinators 2022-09-26 13:03:32 +02:00
Robert Schulze
9c62797d28
Bump LLVM from 12 to 13 2022-09-26 07:13:46 +00:00
Alexey Milovidov
bca4cc98c3
Merge pull request #41595 from Algunenano/fix_variadic_reading_random_data
Do not process rows in aggregations if any of the parameters is NULL
2022-09-22 07:57:37 +03:00
Alexey Milovidov
45afacdae4
Merge pull request #41186 from ClickHouse/fix-three-fourth-of-trash
Fix more than half of the trash
2022-09-22 07:28:26 +03:00
Alexey Milovidov
45bd3cfc30 Merge branch 'master' into fix-three-fourth-of-trash 2022-09-20 21:27:41 +02:00
Alexey Milovidov
a469000497 Fix build 2022-09-20 21:26:11 +02:00
Raúl Marín
fd503b34d9 Remove any processing of undelying values for NULLs 2022-09-20 18:43:21 +02:00
Raúl Marín
90e5a06627 Do not replace NULLs by their underlying value on aggregations 2022-09-20 18:04:29 +02:00
Raúl Marín
766f34d9ae Prevent crash when passing wrong aggregation states to groupBitmap* 2022-09-20 13:17:04 +02:00
Vladimir C
befc0440e3
Merge pull request #41511 from Algunenano/batch_nullable_assert 2022-09-20 09:21:52 +02:00
Raúl Marín
e89dffbb95 Fix AggregateFunctionNullVariadic batch with null_is_skipped=false 2022-09-19 14:34:08 +02:00
Kruglov Pavel
47f6f09ce0
Merge branch 'master' into improve-combinators 2022-09-19 14:31:12 +02:00
Alexey Milovidov
bb6f1bfce2 Fix 9/10 of trash 2022-09-19 08:53:20 +02:00
Alexey Milovidov
730655d4fd Fix 8/9 of trash 2022-09-19 08:53:20 +02:00
Alexey Milovidov
42b0d444da Fix 7/8 of trash 2022-09-19 08:53:20 +02:00
Alexey Milovidov
3c0961c48b
Merge branch 'master' into fix-map-combinator 2022-09-19 09:32:16 +03:00
Alexey Milovidov
5d9e125c71 Fix clang-tidy 2022-09-19 00:28:32 +02:00
Alexey Milovidov
c8c728e740
Merge pull request #41449 from ClickHouse/fix-categorial-information
Fix incorrect properties of `categorialInformationValue` function
2022-09-18 05:26:26 +03:00
Alexey Milovidov
6f1878b12a Fix error 2022-09-18 01:17:22 +02:00
Alexey Milovidov
c424ad12aa Simplification 2022-09-18 00:09:21 +02:00
Alexey Milovidov
e2d434ea18 Start with code removal 2022-09-17 23:37:57 +02:00
Alexey Milovidov
f4a48cd4d6 Remove cruft 2022-09-17 22:16:31 +02:00
Alexey Milovidov
ada7a44ae4 Remove -WithTerminatingZero methods 2022-09-17 05:34:18 +02:00
avogar
0101cc2e56 Support complex combinators in window transform, arrayReduce*, initializeAggregation and Aggregate functons versionning 2022-09-16 19:07:36 +00:00
avogar
fa172e21ae Remove unnecessary method implementation 2022-09-16 17:47:05 +00:00
avogar
c9a9ef5b7e Fix comments 2022-09-16 16:12:30 +00:00
Raúl Marín
c3ff66bd9d
Implement batch processing for aggregate functions with multiple nullable arguments (#41058)
* Implement batch processing for aggregate functions with multiple nullable arguments

* Fix broken perf test

* Improve filter handling in addBatchSinglePlace with nullable arguments

* Fix detecting the Null filter usage
2022-09-15 23:51:38 +02:00
Raúl Marín
6dac509739
Speed up reading uniqState (#41089)
* Speed up reading UniquesHashSet

* Improve uniq serialization tests
2022-09-15 23:41:15 +02:00
avogar
92979af3bf Add missing methods in combinators 2022-09-15 17:45:50 +00:00
avogar
6bb6c9e916 Fix comment 2022-09-15 12:41:39 +00:00
avogar
d41bb7c2a4 Fix comment 2022-09-15 12:40:32 +00:00
avogar
f1a0501eb2 Fix memory leaks and segfaults in combinators 2022-09-14 18:01:49 +00:00
Alexey Milovidov
9a0892c40c
Merge pull request #41171 from ClickHouse/fix-half-of-trash
Fix half of trash
2022-09-11 21:40:22 +03:00
Alexey Milovidov
7f5a1cbe16 Faster build 2022-09-11 09:29:24 +02:00
Alexey Milovidov
5592c8e775 Faster build 2022-09-11 08:50:44 +02:00
Alexey Milovidov
88e9178830 Faster build 2022-09-11 08:46:05 +02:00
Alexey Milovidov
7f1e7b5967 Merge branch 'master' into fix-half-of-trash 2022-09-11 06:20:47 +02:00
Alexey Milovidov
90fd507292 Fix test 2022-09-11 06:18:43 +02:00
Alexey Milovidov
fd235919aa Remove some methods 2022-09-10 05:04:40 +02:00
Alexey Milovidov
fa62c7e982 Fix half of trash 2022-09-10 04:08:16 +02:00
Kruglov Pavel
992ba99da4
Add comment 2022-09-08 15:23:29 +02:00
avogar
0475eb0b17 Make better 2022-09-07 18:53:22 +00:00
avogar
5c0c19c533 Make generic solution 2022-09-07 18:49:34 +00:00
avogar
9da22f7b7c Fix possible use-heap-after-free in -Map combinator 2022-09-07 15:06:56 +00:00
Fangyuan Deng
5c2f35c302
Merge branch 'master' into UniqSketch 2022-08-31 10:23:46 +08:00
Alexey Milovidov
91ed3ebe9a Remove the remaining parts of "unbundled" build 2022-08-27 02:18:47 +02:00
pzhdfy
172b5025e2 use camelCase aNotB 2022-08-17 11:24:19 +08:00
Nikita Mikhaylov
00d2c57a68
Merge branch 'master' into add-allocation-ptr-to-trace-log 2022-08-12 13:32:24 +02:00
pzhdfy
2d5446a86b add FunctionsUniqTheta 2022-08-05 14:11:52 +08:00
Alexey Milovidov
9e46abc560
Merge pull request #39420 from amosbird/better-projection1-fix1
Normalize AggregateFunction types and state representations
2022-08-04 03:06:55 +03:00
Amos Bird
b98e645ff7
Revert "test what will be wrong if state returns norm type"
This reverts commit 55802099bc.
2022-08-02 11:33:45 +08:00
Amos Bird
c8aaa32f9c
Revert "Another test"
This reverts commit 69347028c5.
2022-08-02 10:43:48 +08:00
Amos Bird
69347028c5
Another test 2022-08-02 03:08:25 +08:00
Amos Bird
55802099bc
test what will be wrong if state returns norm type 2022-08-01 21:04:16 +08:00
Amos Bird
09c99d8440
Fix tests 2022-08-01 21:04:14 +08:00
Amos Bird
0e746c1afa
More format refactor 2022-08-01 21:04:13 +08:00
Amos Bird
f11d0484f3
Normalize everything else 2022-08-01 21:04:11 +08:00
BiteTheDDDDt
cb68180cdf fix align of AggregateFunctionDistinct 2022-07-29 15:22:03 +08:00
Bharat Nallan
a48f181d21
Update src/AggregateFunctions/AggregateFunctionQuantile.cpp
Co-authored-by: Nikolay Degterinsky <43110995+evillique@users.noreply.github.com>
2022-07-28 08:55:57 -07:00
Nikolai Kochetov
91043351aa Fixing build. 2022-07-20 20:30:16 +00:00
Robert Schulze
13482af4ee
First try at reducing the use of StringRef
- to be replaced by std::string_view
- suggested in #39262
2022-07-17 17:26:02 +00:00
Robert Schulze
deda29b46b
Pass const StringRef by value, not by reference
See #39224
2022-07-15 11:34:56 +00:00
bharatnc
46129a9bcd try simplifying limit checks 2022-07-13 17:52:50 -07:00
Robert Schulze
1a7727a254
Prefix overridden add_executable() command with "clickhouse_"
A simple HelloWorld program with zero includes except iostream triggers
a build of ca. 2000 source files. The reason is that ClickHouse's
top-level CMakeLists.txt overrides "add_executable()" to link all
binaries against "clickhouse_new_delete". This links against
"clickhouse_common_io", which in turn has lots of 3rd party library
dependencies ... Without linking "clickhouse_new_delete", the number of
compiled files for "HelloWorld" goes down to ca. 70.

As an example, the self-extracting-executable needs none of its current
dependencies but other programs may also benefit.

In order to restore access to the original "add_executable()", the
overriding version is now prefixed. There is precedence for a
"clickhouse_" prefix (as opposed to "ch_"), for example
"clickhouse_split_debug_symbols". In general prefixing makes sense also
because overriding CMake commands relies on undocumented behavior and is
considered not-so-great practice (*).

(*) https://crascit.com/2018/09/14/do-not-redefine-cmake-commands/
2022-07-11 19:36:18 +02:00
Bharat Nallan Chakravarthy
054ce6f712 rename func to quantileInterpolatedWeighted 2022-07-09 14:02:39 +05:30
Bharat Nallan Chakravarthy
f4488dfee1 Merge remote-tracking branch 'upstream/master' into ncb/weighted-quantile-approx 2022-07-09 13:45:00 +05:30
Nikolai Kochetov
b262ca7dd6 Refactoring 2022-07-08 22:04:56 +00:00
Nikolai Kochetov
8b56695073 Review fixes. 2022-07-08 14:46:11 +00:00
Nikolai Kochetov
19c7a70dcb Check args. 2022-07-07 20:45:46 +00:00
Nikolai Kochetov
3788122f43 Update AggregateFunctionFlameGraph 2022-07-07 14:33:20 +00:00
Nikolai Kochetov
dcdf2e4527 Track allocation ptr in system.trace_log. Add aggregate function for flamegraph. 2022-07-07 11:54:41 +00:00
Alexey Milovidov
bfc9ed6172
Merge pull request #38722 from ClickHouse/fix-rank-corr-functions
Fix a bug in `rankCorr` function
2022-07-03 20:30:32 +03:00
Azat Khuzhin
4375a336fd Fix use-after-free for Map combinator that leads to incorrect result
This use-after-free can be reproduced with distributed queries.

Also note, that this is not sumMappedArray() and friends (that
previously called sumMap()) but Map combinator.

You will find ASan report in details.

<details>

    READ of size 8 at 0x62d00012d218 thread T186 (QueryPipelineEx)
    2022.07.03 05:09:40.000234 [ 31956 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 1.23 GiB, peak 1.23 GiB, will set to 1.25 GiB (RSS), difference: 19.51 MiB
    2022.07.03 05:09:41.000137 [ 31956 ] {} <Trace> AsynchronousMetrics: MemoryTracking: was 1.25 GiB, peak 1.25 GiB, will set to 1.26 GiB (RSS), difference: 3.76 MiB
        #0 0x1233a0d8 in DB::AggregateFunctionSumData<>::get() const build_docker/../src/AggregateFunctions/AggregateFunctionSum.h:245:16
        #1 0x1233a0d8 in DB::AggregateFunctionSum<>::insertResultInto(char*, DB::IColumn&, DB::Arena*) const build_docker/../src/AggregateFunctions/AggregateFunctionSum.h:536:70
        #2 0x1470f910 in DB::AggregateFunctionMap<char8_t>::insertResultInto() const build_docker/../src/AggregateFunctions/AggregateFunctionMap.h:236:26
        #3 0x147110ce in DB::IAggregateFunctionHelper<>::insertResultIntoBatch() const build_docker/../src/AggregateFunctions/IAggregateFunction.h:618:53
        #4 0x2c4269d7 in void DB::Aggregator::convertToBlockImplFinal<>() const build_docker/../src/Interpreters/Aggregator.cpp:1878:49
        #5 0x2c403b9f in void DB::Aggregator::convertToBlockImpl<>() const build_docker/../src/Interpreters/Aggregator.cpp:1714:13
        #6 0x2be09b53 in DB::Aggregator::prepareBlockAndFillSingleLevel() const::$_2::operator()() const build_docker/../src/Interpreters/Aggregator.cpp:2144:9
        #7 0x2be09b53 in DB::Block DB::Aggregator::prepareBlockAndFill<>() const build_docker/../src/Interpreters/Aggregator.cpp:2000:5
        #8 0x2be09b53 in DB::Aggregator::prepareBlockAndFillSingleLevel() const build_docker/../src/Interpreters/Aggregator.cpp:2150:12
        #9 0x2be37de3 in DB::Aggregator::mergeBlocks() build_docker/../src/Interpreters/Aggregator.cpp:3032:17
        #10 0x308c27f8 in DB::MergingAggregatedBucketTransform::transform() build_docker/../src/Processors/Transforms/MergingAggregatedMemoryEfficientTransform.cpp:360:37

    0x62d00012d218 is located 3608 bytes inside of 32768-byte region [0x62d00012c400,0x62d000134400)
    freed by thread T186 (QueryPipelineEx) here:
        #0 0xd701312 in free (/work1/azat/tmp/upstream/clickhouse-asan+0xd701312) (BuildId: b7977aef37e9f720)
        ...
        #8 0x2e3c22eb in DB::ColumnAggregateFunction::~ColumnAggregateFunction() build_docker/../src/Columns/ColumnAggregateFunction.cpp:89:1
        ...
        #18 0xd9fcdd4 in std::__1::vector<DB::ColumnWithTypeAndName, std::__1::allocator<DB::ColumnWithTypeAndName> >::~vector() build_docker/../contrib/libcxx/include/vector:401:9
        #19 0x2be373f4 in DB::Aggregator::mergeBlocks() build_docker/../contrib/libcxx/include/__memory/unique_ptr.h
        #20 0x308c27f8 in DB::MergingAggregatedBucketTransform::transform() build_docker/../src/Processors/Transforms/MergingAggregatedMemoryEfficientTransform.cpp:360:37

    previously allocated by thread T186 (QueryPipelineEx) here:
        #0 0xd7015be in malloc (/work1/azat/tmp/upstream/clickhouse-asan+0xd7015be) (BuildId: b7977aef37e9f720)
        #1 0xd85190a in Allocator<false, false>::allocNoTrack(unsigned long, unsigned long) build_docker/../src/Common/Allocator.h:227:27
        #2 0xd988d45 in Allocator<false, false>::alloc(unsigned long, unsigned long) build_docker/../src/Common/Allocator.h:96:16
        #3 0xd988d45 in DB::Arena::MemoryChunk::MemoryChunk(unsigned long, DB::Arena::MemoryChunk*) build_docker/../src/Common/Arena.h:54:64
        #4 0xd98904b in DB::Arena::addMemoryChunk(unsigned long) build_docker/../src/Common/Arena.h:122:20
        #5 0xec9542c in DB::Arena::alignedAlloc(unsigned long, unsigned long) build_docker/../src/Common/Arena.h:171:13
        #6 0x1470f123 in DB::AggregateFunctionMap<char8_t>::deserialize() const build_docker/../src/AggregateFunctions/AggregateFunctionMap.h:205:35

</details>

P.S. Thanks to @den-crane for the reproducer.

Fixes: #35359 (cc @den-crane @dongxiao-yang)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-03 12:36:30 +03:00
Alexey Milovidov
7adc87a37d
Merge pull request #38413 from nickitat/cache_values_inside_hash_table_grower
Precalculate values inside `HashTableGrower`
2022-07-02 23:30:24 +03:00
Alexey Milovidov
668f06b2db Fix error 2022-07-02 03:40:20 +02:00
Anton Popov
7c721578c7
Merge pull request #38320 from CurtizJ/dynamic-columns-16
Improve performace of insertion to columns of type JSON
2022-06-30 14:18:20 +02:00
Nikita Taranov
986ead7358 use old HashTableGrower with *WithStackMemory data structures 2022-06-27 20:34:18 +02:00
Nikita Taranov
abcefeeb41 cleanup 2022-06-25 23:15:59 +02:00
Nikita Taranov
c476427422 stash 2022-06-25 01:27:24 +02:00
Bharat Nallan Chakravarthy
d0bfb4e1f5 handle nan 2022-06-23 23:31:54 +05:30
Bharat Nallan Chakravarthy
33704888e5 try add some numeric limits checks 2022-06-23 20:21:50 +05:30
Bharat Nallan Chakravarthy
4e7f8b0935 try fix fuzzer error 2022-06-23 11:51:19 +05:30
Anton Popov
52db1b35a1 improve performace of insertion to columns of type JSON 2022-06-22 17:45:51 +00:00
Bharat Nallan Chakravarthy
4b727e812c fix tests 2022-06-22 08:23:15 +05:30
Bharat Nallan Chakravarthy
5c878d0ef9 add comments 2022-06-21 19:23:16 +05:30
Bharat Nallan Chakravarthy
ff5a30a1f8 fix tests 2022-06-21 17:51:17 +05:30
Bharat Nallan Chakravarthy
578fd9e60b implement quantileApproximateWeighted 2022-06-21 07:24:30 +05:30
mergify[bot]
670a63865e
Merge branch 'master' into window-function-expression 2022-06-19 22:14:54 +00:00
Maksim Kita
bf6d155170 Aggregate functions added restrict into batch methods 2022-06-15 14:11:10 +02:00
mergify[bot]
9e0d16f21d
Merge branch 'master' into window-function-expression 2022-06-10 15:31:53 +00:00
Nikita Mikhaylov
85a1204e95
Do not calculate integrals in statistical tests (#36953) 2022-06-07 15:39:39 +02:00
zhao zhou
ab131af843 fix format issue 2022-06-06 10:02:21 +08:00
zhao zhou
cd2911d635 Add avx512 support for Aggregate Sum, function unary arithmetic, function comparison 2022-06-06 09:29:47 +08:00
Dmitry Novik
58d79f8eed Support expressions with window functions 2022-06-04 02:01:49 +00:00
Alexey Milovidov
9e3242f186
Merge pull request #37617 from CurtizJ/aggregation-sparse-columns
Better performance with sparse columns in aggregate functions
2022-05-29 09:36:07 +03:00
Anton Popov
c39d95e2e6 add perf test 2022-05-28 12:56:38 +00:00
Anton Popov
b2cff26ecf better performace with sparse columns in aggregate functions 2022-05-28 02:22:20 +00:00
Maksim Kita
e6e4b2826d Dynamic dispatch infrastructure style fixes 2022-05-24 14:25:29 +02:00
Robert Schulze
b475fbc9a7
Merge pull request #37300 from ClickHouse/cmake-cleanup-pt3
Various cmake cleanups
2022-05-20 10:02:36 +02:00