Commit Graph

7522 Commits

Author SHA1 Message Date
Igor Nikonov
4bf42ce867 Merge remote-tracking branch 'origin/master' into skipping_sorting_step 2022-08-02 10:50:25 +00:00
Igor Nikonov
0cb59aa38c ExpressionStep: simple check if expression changes sorting order 2022-08-02 10:45:05 +00:00
Alexander Tokmakov
82b50e79cf
Merge branch 'master' into tsan_clang_15 2022-08-02 13:00:55 +03:00
Alexander Tokmakov
5050e0aca5
Revert "Limit number of analyze for one query" 2022-08-02 12:48:31 +03:00
Nikolai Kochetov
a3bf9496d4
Merge pull request #39799 from ClickHouse/fix-extra-column-after-array-join-optimization
Fix extra column after ARRAY JOIN optimization.
2022-08-02 10:35:35 +02:00
Frank Chen
40c6e4c0d6 Merge remote-tracking branch 'origin/master' into tracing_context_propagation 2022-08-02 10:02:09 +08:00
Nikolai Kochetov
77c143aa23 Fix extra column after ARRAY JOIN optimization. 2022-08-01 17:56:27 +00:00
Alexander Tokmakov
1567b65473 Merge branch 'master' into replicated_database_improvements 2022-08-01 19:12:37 +02:00
Alexander Tokmakov
0d68b1c67f fix build with clang-15 2022-08-01 18:00:54 +02:00
Robert Schulze
bf574b9154
Merge pull request #39760 from ClickHouse/bit-fiddling
Use std::popcount, ::countl_zero, ::countr_zero functions
2022-08-01 17:04:51 +02:00
Amos Bird
f11d0484f3
Normalize everything else 2022-08-01 21:04:11 +08:00
Anton Popov
8a3ec52b5e
Merge pull request #39752 from CurtizJ/fix-index-analysis
Fix index analysis with tuples and `IN`
2022-08-01 14:41:46 +02:00
Kruglov Pavel
6457c069a9
Merge pull request #39293 from kssenii/fix-positional-args-case
Fix positional arguments in case of unneeded columns pruning
2022-08-01 12:42:18 +02:00
Vladimir Chebotaryov
aaa6049678
Merge branch 'master' into betterorderbyoptimization 2022-08-01 11:42:48 +03:00
Dmitry Novik
ab5a147065
Merge pull request #38725 from azat/fix-order-by-projection
Fix ORDER BY that matches projections ORDER BY
2022-08-01 00:32:59 +02:00
Robert Schulze
d39259a4c0
More conversions 2022-07-31 22:06:02 +00:00
Vladimir Chebotaryov
9fc3addea9 Fixed using column_after_join for handling WINDOW expressions in ExpressionAnalyzer, shall be aggregated_columns. 2022-07-31 23:36:20 +03:00
Nikolai Kochetov
22fbfe19a4 Merge branch 'master' into use-dag-in-key-condition 2022-07-31 21:54:12 +02:00
Alexey Milovidov
ccef227494
Merge pull request #38185 from vdimir/analyze_stuck
Limit number of analyze for one query
2022-07-31 22:53:09 +03:00
kssenii
e5f4a619ed Merge master 2022-07-31 20:24:40 +03:00
Robert Schulze
a7734672b9
Use std::popcount, ::countl_zero, ::countr_zero functions
- Introduced with the C++20 <bit> header

- The problem with __builtin_c(l|t)z() is that 0 as input has an
  undefined result (*) and the code did not always check. The std::
  versions do not have this issue.

- In some cases, we continue to use buildin_c(l|t)z(), (e.g. in
  src/Common/BitHelpers.h) because the std:: versions only accept
  unsigned inputs (and they also check that) and the casting would be
  ugly.

(*) https://gcc.gnu.org/onlinedocs/gcc/Other-Builtins.html
2022-07-31 15:16:51 +00:00
Igor Nikonov
7f0adb5eb0 Merge remote-tracking branch 'origin/master' into skipping_sorting_step 2022-07-31 07:07:36 +00:00
Anton Popov
095e400075 fix index analysis with tuples and IN 2022-07-31 00:38:52 +00:00
kssenii
d66c108a04 Fix 2022-07-30 18:42:22 +03:00
Maksim Kita
acb0137dbb
Merge pull request #39718 from kitaisreal/join-enums-refactoring
Join enums refactoring
2022-07-30 13:53:08 +02:00
Alexey Milovidov
1e974b55ea
Merge branch 'master' into analyze_stuck 2022-07-30 04:56:21 +03:00
kssenii
efff78819a Merge remote-tracking branch 'upstream/master' into fix-positional-args-case 2022-07-29 22:07:51 +03:00
Maksim Kita
8ba42876fc Fixed build 2022-07-29 19:35:15 +02:00
Maksim Kita
8fc6bad4f4 Join enums refactoring 2022-07-29 18:35:05 +02:00
Alexander Tokmakov
07617df98e
Merge branch 'master' into fix_flaky_tests_ordinary 2022-07-29 18:02:05 +03:00
Nikolai Kochetov
59a11b32ad
Merge branch 'master' into use-dag-in-key-condition 2022-07-29 17:01:33 +02:00
Alexander Tokmakov
0cef018c29 clear mmapio cache when dropping table from Ordinary 2022-07-29 14:26:41 +02:00
Robert Schulze
a3c52f1140
Merge pull request #39679 from azat/fix-utils
Fix utils build on CI
2022-07-29 14:02:53 +02:00
Alexander Tokmakov
396e49d243
Merge pull request #39686 from azat/zookeeper_log.duration_ms
Add duration_ms into system.zookeeper_log
2022-07-29 11:40:30 +03:00
Azat Khuzhin
498c8b3c52 Fix clang-tidy in utils/examples
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-29 11:36:51 +03:00
Yakov Olkhovskiy
0f1747b421
Merge pull request #39621 from amosbird/trivial-optimization
Combining sumIf->countIf and multiIf->if opt.
2022-07-28 16:08:36 -04:00
Azat Khuzhin
e1f8cff3b4 Add duration_ms into system.zookeeper_log
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-28 22:34:51 +03:00
Nikolai Kochetov
6919ae7c91 Fixing a test with indexHint 2022-07-28 12:24:16 +00:00
Alexander Tokmakov
b3732df248 Merge branch 'master' into replicated_database_improvements 2022-07-28 13:08:30 +02:00
Alexander Tokmakov
c7fb6aa6d5 fix style check so maybe CI checks will strart 2022-07-28 13:07:46 +02:00
Antonio Andelic
15e999f8bc
Merge pull request #39096 from ClickHouse/keeper-version-check
Add version for Keeper API
2022-07-28 10:10:49 +02:00
Vitaly Baranov
f8ebe76826
Merge pull request #39503 from vitlibar/improve-system-backups-table
Improve system.backups table
2022-07-27 20:25:39 +02:00
Vladimir C
115506356c
Merge branch 'master' into refactor-prepared-sets 2022-07-27 19:57:23 +02:00
Alexander Tokmakov
24725b5f95 fix synchronous queries 2022-07-27 19:15:00 +02:00
Vladimir C
a8be51f4df
Merge pull request #39567 from Algunenano/progress_result_rows_and_bytes
Add result_rows and result_bytes to progress reports
2022-07-27 16:43:55 +02:00
vdimir
8eecb9ef82
upd PreparedSets: rename/change signature of methods, add comments 2022-07-27 11:22:16 +00:00
Nikolai Kochetov
873432fb53
Merge pull request #37849 from ClickHouse/bug-with-fill-date
Enforce equality of WITH FILL type with ORDER BY column's type for date/time types.
2022-07-27 12:27:53 +02:00
Alexander Tokmakov
44463cfca0
Merge pull request #39565 from ClickHouse/fix_39511
Fix create/drop index on cluster
2022-07-27 13:21:51 +03:00
Alexander Tokmakov
8fc075a527
Merge pull request #39619 from ClickHouse/try-do-enable-global-allocations-for-attach
Replace MemoryTrackerBlockerInThread to LockMemoryExceptionInThread
2022-07-27 13:13:04 +03:00
Vitaly Baranov
fc16a15ecf Rename column "uuid" -> "id" in system.backups and allow user to set it in a query. 2022-07-27 09:04:10 +02:00
Vitaly Baranov
d129be2a9e Remove column "backup_name" from the result of a BACKUP/RESTORE query 2022-07-27 09:04:10 +02:00
Vitaly Baranov
afd0982187 Remove column "internal" from system.backups 2022-07-27 09:04:10 +02:00
Vitaly Baranov
16a60b5e93
Merge pull request #39455 from vitlibar/fix-locks-add-tests
Improve synchronization between hosts in distributed backup and fix locks
2022-07-27 09:02:58 +02:00
Alexander Gololobov
a64aa00869
Merge pull request #37893 from zhangjmruc/feature/sql-standard-delete
Support SQL standard "delete from ... where ..." syntax and lightweight implementation on merge tree tables
2022-07-26 23:39:07 +02:00
vdimir
5ce2960f03
Get rid of SelectQueryInfoBase -> SelectQueryInfo 2022-07-26 18:39:09 +00:00
vdimir
11d37a8dc9
Properly initialize prepared_sets 2022-07-26 18:39:09 +00:00
vdimir
d9928ac93d
Add methods to SubqueryForSet, do not use refernce to SetPtr 2022-07-26 18:39:09 +00:00
vdimir
1e3fa2e01f
Refactor PreparedSets/SubqueryForSet 2022-07-26 18:39:02 +00:00
Nikolai Kochetov
fa0707b4e7 Review fixes. 2022-07-26 17:51:09 +00:00
Amos Bird
5ad8314367
Combining sumIf->countIf and multiIf->if opt. 2022-07-26 23:55:13 +08:00
Nikolai Kochetov
33ce662d3e Replace MemoryTrackerBlockerInThread to LockMemoryExceptionInThread in some places. Reduced MemoryTrackerBlockerInThread level to User. 2022-07-26 15:22:00 +00:00
Dmitry Novik
cf381df93f
Merge branch 'master' into window-order-by 2022-07-26 13:32:35 +02:00
Vitaly Baranov
f0cd564648 Changes after review and added comments. 2022-07-26 11:58:05 +02:00
Vladimir C
3bd5ca9b6a
Merge pull request #39271 from vdimir/join-alg-setting
Cleanup logic around join_algorithm setting, add docs
2022-07-26 11:00:22 +02:00
Vladimir C
888417e788
Merge pull request #39556 from vdimir/asof_optimize_predicate_bug_37813
Fix bug in ASOF JOIN with enable_optimize_predicate_expression
2022-07-26 10:51:25 +02:00
Alexander Gololobov
0666ec2e1f
Merge branch 'master' into feature/sql-standard-delete 2022-07-26 10:42:39 +02:00
Raúl Marín
6e3a4b0a3d Add result_rows and result_bytes to progress reports and summary 2022-07-26 10:40:16 +02:00
Antonio Andelic
35b61cc94e Merge branch 'master' into keeper-version-check 2022-07-26 07:47:57 +00:00
jianmei zhang
c1834d183b ReplicatedMergeTree support lightweight delete 2022-07-26 11:50:09 +08:00
Vladimir Chebotaryov
f32d9c5539
Uppercase ROWS, GROUPS, RANGE in queries with windows. (#39410) 2022-07-25 22:53:53 +02:00
Alexander Tokmakov
fafda5cae0 Merge branch 'master' into replicated_database_improvements 2022-07-25 20:22:22 +02:00
Alexander Tokmakov
f1e1cff272 fix create/drop index on cluster 2022-07-25 18:00:54 +02:00
Alexander Gololobov
48de02a7b8 Capitalized const name 2022-07-25 16:32:16 +02:00
vdimir
b6f640013d
Fix bug in ASOF JOIN with enable_optimize_predicate_expression 2022-07-25 12:58:34 +00:00
Nikolai Kochetov
b70be40804
Merge branch 'master' into use-dag-in-key-condition 2022-07-25 14:30:22 +02:00
Igor Nikonov
572dd864fe Merge remote-tracking branch 'origin/master' into skipping_sorting_step 2022-07-25 12:19:14 +00:00
Alexander Gololobov
460950ecdc
Merge branch 'master' into feature/sql-standard-delete 2022-07-24 21:27:22 +02:00
Alexey Milovidov
0209012e5e
Merge pull request #39517 from pkit/pkit/fix_examples
fix `-DENABLE_EXAMPLES=1` in master
2022-07-24 17:41:23 +03:00
Azat Khuzhin
22d8e532ed Fix ORDER BY that matches projections ORDER BY
In case of projection is seleted and it is comlete (all parts has such
projection) and ORDER BY matches projection ORDER BY, and
optimize_read_in_order=1 (default), then the sorting is simply not done,
because projections has separate plan, and so
InterpreterSelectQuery::executeOrder() -> SortingStep has
pipeline.getNumStreams() == 0 and it cannot do sorting.

Fix this, by adding sorting when creating plan for reading from
projections.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-24 15:23:13 +03:00
Alexander Gololobov
c8b3c574a4 Disable lightweight delete if table has projections 2022-07-24 12:21:47 +02:00
Alexander Gololobov
594195451e Cleanups 2022-07-24 12:21:18 +02:00
Constantine Peresypkin
d645d03e89 fix -DENABLE_EXAMPLES=1 in master 2022-07-23 19:00:52 +02:00
Alexander Tokmakov
39ba920cb6 Merge branch 'master' into replicated_database_improvements 2022-07-22 13:38:26 +02:00
Ilya Yatsishin
196fe5a269
Merge branch 'master' into exact-rows-before-limit 2022-07-22 12:34:30 +02:00
Alexander Tokmakov
bed2206ae9
Merge pull request #39460 from ClickHouse/remove_some_dead_and_commented_code
Remove some dead and commented code
2022-07-22 13:24:34 +03:00
Antonio Andelic
3040ff0959 Merge branch 'master' into keeper-version-check 2022-07-22 08:07:55 +00:00
Vitaly Baranov
7795b2cec3 Fix system.backups: now it can show duplicate UUIDs with different flag. 2022-07-21 20:30:26 +02:00
Dmitry Novik
c79b93505f
Merge branch 'master' into window-order-by 2022-07-21 19:34:06 +02:00
Alexander Gololobov
50bd8147fd Make lightweight delete work with compact parts (not in optimal way yet) 2022-07-21 17:59:34 +02:00
Nikolai Kochetov
17de7b2876
Revert "Fix trivial count optimization with array join" 2022-07-21 17:14:34 +02:00
vdimir
96bcae419c
Cleanup logic around join_algorithm setting 2022-07-21 14:53:39 +00:00
Maksim Kita
82fc7375dd
Merge pull request #39444 from amosbird/fix-trivial-count-opt-1
Fix trivial count optimization with array join
2022-07-21 16:35:49 +02:00
Vadim Volodin
85bf022258 review zookeeper and partition matching 2022-07-21 16:57:28 +03:00
Alexander Tokmakov
a8da5d96fc remove some dead and commented code 2022-07-21 15:05:48 +02:00
Anton Kozlov
0e44e34e69 Do not optimize GROUP BY functions that shadow their arguments 2022-07-21 11:33:48 +00:00
Nikolai Kochetov
e6969d5010 Respect table alias for additional_table_filters. 2022-07-21 11:23:09 +00:00
Vitaly Baranov
dc392cd4d3 Improve synchronization between hosts in distributed backup.
Use ephemeral zk nodes to check other hosts for termination.
2022-07-21 11:45:26 +02:00
Alexander Gololobov
1ea9f143ff Leave only _row_exists-based implementation of lightweight delete 2022-07-21 11:26:13 +02:00
Amos Bird
98ff54700a
Fix trivial count optimization with array join 2022-07-21 16:23:25 +08:00
Nikolai Kochetov
e15967e9db
Merge pull request #38475 from ClickHouse/additional-filters
Additional filters for a table (from setting)
2022-07-21 07:52:04 +02:00
Azat Khuzhin
4b3f90870d
Remove specialization global lock/unlock from ActionLocksManager (#39215)
This had been done in InterpreterSystemQuery explicitly, with grants
checking.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-21 01:29:35 +02:00
Alexander Tokmakov
6e77155dc8 fix 2022-07-20 23:11:35 +02:00
Nikolai Kochetov
6028f7909b Fixing build. 2022-07-20 20:45:29 +00:00
Nikolai Kochetov
91aa2385ca
Merge branch 'master' into additional-filters 2022-07-20 18:56:24 +02:00
Igor Nikonov
7616a24c40
Merge pull request #38980 from ClickHouse/explain_ast_rewrite_follow_up
EXPLAIN AST rewrite: rename to optimize
2022-07-20 18:42:14 +02:00
Nikolai Kochetov
4e8cd70b1d
Merge branch 'master' into use-dag-in-key-condition 2022-07-20 17:38:33 +02:00
Harry Lee
466fceb3ee
Fix exception in AsynchronousMetrics for s390x (#39193) 2022-07-20 15:25:33 +02:00
Yakov Olkhovskiy
c4d040e02c
Merge branch 'master' into bug-with-fill-date 2022-07-20 09:10:45 -04:00
Dmitry Novik
3ceaa25d8f
Merge branch 'master' into window-order-by 2022-07-20 14:46:54 +02:00
Dmitry Novik
a09422de7b
Merge pull request #38642 from ClickHouse/group-by-use-nulls
Add group_by_use_nulls setting
2022-07-20 14:42:42 +02:00
Alexander Tokmakov
e295fd5090 Merge branch 'master' into replicated_database_improvements 2022-07-20 12:49:18 +02:00
Igor Nikonov
5509850b23
Merge branch 'master' into explain_ast_rewrite_follow_up 2022-07-20 12:18:47 +02:00
Nikolai Kochetov
f570cde815 Fixing build. 2022-07-19 20:19:57 +00:00
Dmitry Novik
382194165f Skip window functions 2022-07-19 17:33:21 +00:00
Igor Nikonov
c74600d282
Merge branch 'master' into skipping_sorting_step 2022-07-19 18:59:36 +02:00
Igor Nikonov
1fe83cc8d8 optimize_sorting_for_input_stream setting and perf tests 2022-07-19 16:58:15 +00:00
Nikolai Kochetov
eaeb30a71a Merge branch 'master' into use-dag-in-key-condition 2022-07-19 18:39:52 +02:00
vdimir
c0547bb09c
fix space 2022-07-19 18:33:55 +02:00
vdimir
10e4ef135d
Set default value cross_to_inner_join_rewrite = 2 for comma join 2022-07-19 18:33:54 +02:00
Dmitry Novik
50989bdb68
Merge branch 'master' into group-by-use-nulls 2022-07-19 14:58:01 +02:00
Igor Nikonov
37af968548 Rename option rewrite -> optimize 2022-07-19 12:40:50 +00:00
kssenii
21ebf8874e Merge remote-tracking branch 'upstream/master' into make-cache-composable 2022-07-19 13:36:42 +02:00
Alexander Tokmakov
acb1fa53ed
Merge pull request #39341 from ClickHouse/fix_memory_exceptions_with_transactions
Fix memory exceptions with transactions
2022-07-19 13:31:15 +03:00
Nikolai Kochetov
3ee3144708 Merge branch 'master' into separate-counter-for-rss-in-memory-tracker 2022-07-18 23:20:38 +02:00
Nikolai Kochetov
87e5b31598 Do not include memory buffered by allocator into drift. 2022-07-18 21:16:16 +00:00
Nikolai Kochetov
7ca6663812 Revert "Track mmap."
This reverts commit 77c66666b3.
2022-07-18 20:21:37 +00:00
Nikolai Kochetov
77c66666b3 Track mmap. 2022-07-18 20:21:21 +00:00
Alexander Gololobov
ae0d00083c Renamed __row_exists to _row_exists 2022-07-18 20:07:36 +02:00
Alexander Gololobov
f324ca9921 Cleanups 2022-07-18 20:07:22 +02:00
Alexander Gololobov
f956810fdd Rewrite DELETE FROM into UPDATE __row_exist=0 2022-07-18 20:07:10 +02:00
Alexander Gololobov
9de72d995a POC lightweight delete using __row_exists virtual column and prewhere-like filtering 2022-07-18 20:06:42 +02:00
Robert Schulze
6df3c9d799
Merge pull request #39300 from ClickHouse/stringref-to-stringview
First try at reducing the use of StringRef
2022-07-18 19:20:16 +02:00
Dmitry Novik
cf30f08937 Respect ORDER BY clause in window functions 2022-07-18 16:42:38 +00:00
Alexander Tokmakov
51c4ffad8c block memory exceptions in TransactionLog 2022-07-18 17:40:09 +02:00
kssenii
0aed5a602a Merge master 2022-07-18 16:16:28 +02:00
kssenii
a6655bea1c Some fixes 2022-07-18 14:23:08 +02:00
Antonio Andelic
5170ac0898 Merge branch 'master' into keeper-version-check 2022-07-18 08:57:50 +00:00
Antonio Andelic
742e3d7643 Merge branch 'master' into keeper-version-check 2022-07-18 08:45:00 +00:00
Alexander Tokmakov
611da87217
Merge pull request #39263 from ClickHouse/fix_assertion_in_transactions
Fix assertion in transactions
2022-07-18 11:43:50 +03: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
fffeab2e86
Merge pull request #39262 from ClickHouse/stringref-by-value
Pass const StringRef by value, not by reference
2022-07-17 16:53:15 +02:00
kssenii
8ad26b3111 Merge master 2022-07-16 22:50:03 +02:00
kssenii
e6437f46b1 Fix 2022-07-16 22:23:49 +02:00
Ilya Yatsishin
43ed3df474
Merge pull request #39225 from qoega/query-log-fix-result-bytes 2022-07-15 23:46:03 +02:00
Alexander Tokmakov
e69ea920bf
Merge branch 'master' into fix_assertion_in_transactions 2022-07-15 18:18:34 +03:00
Alexander Tokmakov
5ef7f5f494
Merge pull request #39229 from azat/fix-noexcept-scope
[RFC] Fix NOEXCEPT_SCOPE (before it calls std::terminate and looses the exception)
2022-07-15 18:14:56 +03:00
Nikolai Kochetov
f6a82a6a53
Merge pull request #39157 from ClickHouse/bug-lost-column
prewhere action should preserve sorting columns
2022-07-15 16:37:40 +02:00
Alexander Tokmakov
ae16555aa4 Merge branch 'master' into replicated_database_improvements 2022-07-15 15:50:23 +02:00
Alexander Tokmakov
94b5f1f536 disable transactions with Ordinary database 2022-07-15 15:36:01 +02:00
Robert Schulze
deda29b46b
Pass const StringRef by value, not by reference
See #39224
2022-07-15 11:34:56 +00:00
Kruglov Pavel
a944a92d4c
Merge pull request #39224 from Avogar/string-view-by-value
Pass const std::string_view by value, not by reference
2022-07-15 13:05:56 +02:00
jianmei zhang
780cdfb8f0 Code changes based on review opinions. Make ordinary single alter delete lightwight by default 2022-07-15 12:32:42 +08:00
jianmei zhang
6e6f77ef8a Fix compile error in clang tidy build 2022-07-15 12:32:41 +08:00
jianmei zhang
9d27af7ee2 For some columns mutations, skip to apply deleted mask when read some columns. Also add unit test case 2022-07-15 12:32:41 +08:00
jianmei zhang
b4a37e1e22 Disable optimizations for count() when lightweight delete exists, add hasLightweightDelete() function in IMergeTreeDataPart 2022-07-15 12:32:41 +08:00
jianmei zhang
8696319d62 Support lightweight delete execution using string as deleted rows mask,also part of select can handle LWD 2022-07-15 12:32:41 +08:00
jianmei zhang
8df7b7a030 Support new mutation type for lightweight 2022-07-15 12:32:41 +08:00
jianmei zhang
192ca25e87 Fix style check errors 2022-07-15 12:32:41 +08:00
jianmei zhang
a46188216f Support delete from ... where syntax on mergetree tables 2022-07-15 12:32:41 +08:00
Sergei Trifonov
62f975da60
Merge pull request #39095 from ClickHouse/remote-io-bandwidth-limits
add max_remote_{read,write}_network_bandwidth_for_server settings
2022-07-14 23:14:53 +02:00
Nikolai Kochetov
3c9d4c537a Another try. 2022-07-14 18:36:50 +00:00
avogar
9291d33080 Pass const std::string_view & by value, not by reference 2022-07-14 16:11:57 +00:00
Yakov Olkhovskiy
1f09303d54
Merge pull request #39181 from azat/part_log-merge_algorithm
Add merge_algorithm to system.part_log
2022-07-14 11:43:04 -04:00
Sergei Trifonov
b2317ff710 renaming to be consistent 2022-07-14 17:33:22 +02:00
Azat Khuzhin
b20407fab9 Fix NOEXCEPT_SCOPE (before it calls std::terminate and looses the exception)
Current implementation of NOEXCEPT_SCOPE will not work, you cannot
rethrow exception outside the catch block, this will simply terminate
(via std::terminate) the program.
In other words NOEXCEPT_SCOPE macro will simply call std::terminate on
exception and will lost original exception.

But if NOEXCEPT_SCOPE will accept the code that should be runned w/o
exceptions, then it can catch exception and log it, rewrite it in this
way.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-14 17:16:18 +03:00
Yatsishin Ilya
32e48f661a Fixed query_log result_bytes metric that showed inseted rows instead of bytes 2022-07-14 12:51:56 +00:00
Sergei Trifonov
8a693469f0 Merge branch 'master' into remote-io-bandwidth-limits 2022-07-14 12:38:35 +02:00
Vladimir C
66f2ea5ebb
Merge pull request #39123 from vdimir/fjs-pushdown
Pushdown filter to the right side of sorting join
2022-07-14 09:32:19 +02:00
Nikolai Kochetov
dc20b85078 Remove debug output. 2022-07-13 21:08:23 +00:00
Nikolai Kochetov
9528f7e753
Merge branch 'master' into bug-lost-column 2022-07-13 23:06:38 +02:00
Nikolai Kochetov
ba863b11a4 A little fix. Added test. 2022-07-13 21:06:15 +00:00
Anton Popov
5cb3b25754
Merge pull request #39161 from amosbird/text-log-source-regexp
Control send logs behavior with source name regexp
2022-07-13 21:13:54 +02:00
Sergei Trifonov
15ab3bc99f use context->getWriteSettings() 2022-07-13 19:48:57 +02:00
kssenii
1faf253074 Merge master 2022-07-13 19:30:19 +02:00
Sergei Trifonov
f854507729 merge master and resolve conflicts 2022-07-13 19:07:28 +02:00
Dmitry Novik
9e4f516f35
Merge pull request #39112 from ClickHouse/window-expressions-fix
Fix ActionsDAG construction for window expressions
2022-07-13 18:19:01 +02:00
Antonio Andelic
f05f22aa13 Merge branch 'master' into keeper-version-check 2022-07-13 15:25:48 +00:00
kssenii
d026a8360b Merge remote-tracking branch 'upstream/master' into make-cache-composable 2022-07-13 16:52:33 +02:00
Azat Khuzhin
3720a3843c Add merge_algorithm to system.part_log
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-13 17:16:25 +03:00
Yakov Olkhovskiy
3fd367ea58 check metadata_snapshot is not empty 2022-07-13 10:08:24 -04:00
Antonio Andelic
93d8b8bb61 small fixes 2022-07-13 13:01:13 +00:00
Vladimir C
27ec36ca91
Merge pull request #37648 from vdimir/enable_parallel_hash
Bugfixes and performance improvements for parallel_hash
2022-07-13 14:52:57 +02:00
vdimir
bddf6c1b32
Pushdown filter to the right side of sorting join 2022-07-13 11:36:25 +00:00
kssenii
0d2d3ac2b4 Merge master 2022-07-13 13:26:15 +02:00
Amos Bird
90fa4863f9
Text log source regexp 2022-07-13 17:52:14 +08:00
Yakov Olkhovskiy
1f57f92bf7 prewhere action should preserve sorting columns 2022-07-13 03:01:23 -04:00
Amos Bird
0595c50c92
Fix trivial count with empty set 2022-07-13 12:54:52 +08:00
Dmitry Novik
66ade34508
Merge branch 'master' into window-expressions-fix 2022-07-12 22:36:19 +02:00
Dmitry Novik
5f65b45269
Merge branch 'master' into group-by-use-nulls 2022-07-12 22:36:04 +02:00
vdimir
af55f1c1e3 Update toPowerOfTwo in ConcurrentHashJoin 2022-07-12 20:22:35 +02:00
vdimir
b4176828c6 Apply intHash64 on top of WeakHash32 for parallel join 2022-07-12 20:22:35 +02:00
vdimir
218288ee6c upd ConcurrentHashJoin 2022-07-12 20:22:35 +02:00
vdimir
2ec373c6a7 Number of shards in parallel hash join is always power of two 2022-07-12 20:22:35 +02:00
vdimir
f3e84d8fc6 fix order in 01913_join_push_down_bug 00952_input_function 2022-07-12 20:22:35 +02:00
vdimir
a7ea163e3b Fix parallel hash join to lowcard keys 2022-07-12 20:22:35 +02:00
vdimir
9e0cb37bd7 Disable parallel hash join for asof 2022-07-12 20:22:35 +02:00
Dmitry Novik
d046132265 Allow to use higher-order functions in window expressions 2022-07-11 23:47:46 +00:00
Dmitry Novik
fd9d897df2 Fix ActionsDAG for window expressions 2022-07-11 23:18:44 +00:00
Dmitry Novik
29cfe33ed7 Small fix 2022-07-11 18:14:49 +00:00
Dmitry Novik
66074b3950 Fix distributed aggregation 2022-07-11 18:11:58 +00: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
Ilya Yatsishin
4625e7f519
Merge branch 'master' into exact-rows-before-limit 2022-07-11 15:41:35 +02:00
Sergei Trifonov
43779ec280 add max_remote_{read,write}_network_bandwidth_for_server settings 2022-07-11 14:59:39 +02:00
Vladimir C
ca2e27aaa2
Merge pull request #37841 from vdimir/perf-save-to-stat
Send perf tests results to ci database
2022-07-11 13:07:40 +02:00
Antonio Andelic
37f799550b
Merge pull request #38072 from lingpeng0314/master
Add Keeper related monitoring data
2022-07-10 09:39:57 +02:00
Frank Chen
c559370ec9 Fix test cases 2022-07-09 20:20:04 +08:00
Frank Chen
c2ae762a5a Fix tests 2022-07-09 13:59:11 +08:00
Frank Chen
da57a993e4 Fix CI 2022-07-09 13:43:10 +08:00
vdimir
79c185d22b
make current_query_analyze_count atomic 2022-07-08 13:01:17 +00:00
Alexander Tokmakov
dbaaf2ad83 Merge branch 'master' into replicated_database_improvements 2022-07-08 14:29:02 +02:00
vdimir
d681469275
max_pipeline_depth only throws an error 2022-07-08 11:56:42 +00:00
vdimir
9c348380f6
second analyze and max_pipeline_depth 2022-07-08 11:56:42 +00:00
Alexey Milovidov
a0488dc901
Update src/Interpreters/Context.h 2022-07-08 11:56:42 +00:00
Alexey Milovidov
eae82d7530
Update src/Interpreters/InterpreterSelectQuery.cpp 2022-07-08 11:56:41 +00:00
vdimir
fdf35b20a8
Limit number of analyze for one query 2022-07-08 11:56:40 +00:00
Frank Chen
9711559391 Remove extra code 2022-07-08 18:56:07 +08:00
Frank Chen
6ae2504e57 Fix code 2022-07-08 18:55:59 +08:00
Alexander Tokmakov
63fc95903c fix tests 2022-07-07 23:59:15 +02:00
Dmitry Novik
d1df66687b
Merge branch 'master' into group-by-use-nulls 2022-07-07 20:54:38 +02:00
Dmitry Novik
1587385f7a Cleanup code 2022-07-07 18:53:20 +00:00
Vladimir C
db838f1343
Merge pull request #35796 from vdimir/full-sorting-merge-join 2022-07-07 19:16:49 +02:00
Dmitry Novik
24243c51be Fix distributed grouping sets with nulls 2022-07-07 16:40:35 +00:00
Frank Chen
90efbc323d Fix conflicts 2022-07-07 17:44:32 +08:00
Frank Chen
93dc109e36 Fix code 2022-07-07 17:44:19 +08:00
Frank Chen
495555f04f Remove useless span 2022-07-07 17:42:53 +08:00
Frank Chen
57a7e4a7c9 Remove old API reference 2022-07-07 17:42:35 +08:00
Frank Chen
8c04456148 Fix query span at executeQuery layer 2022-07-07 17:41:58 +08:00
Frank Chen
2e8c530bed Move thread trace context out of ThreadStatus 2022-07-07 17:41:10 +08:00
Igor Nikonov
fa0d54a3b2 Merge remote-tracking branch 'origin/master' into order_by_with_braces 2022-07-07 08:13:49 +00:00
Igor Nikonov
01bbfd86ad
Merge pull request #38910 from ClickHouse/explain_ast_after_rewrite
EXPLAIN AST rewrite option
2022-07-07 10:09:55 +02:00
lingpeng0314
079d4bd0dd rename keeper_4lw_info to keeper_info
- to make clang build successfully
2022-07-07 15:13:51 +08:00
Igor Nikonov
6be6a13c2f
Merge branch 'master' into order_by_with_braces 2022-07-07 00:36:12 +02:00
Igor Nikonov
77317c65fd
Merge pull request #38902 from ClickHouse/interpreter_cleanup_2
Interpreter cleanup: ContextPtr -> const ContextPtr & in parameters
2022-07-06 23:46:55 +02:00
Alexander Tokmakov
388872550a Merge branch 'master' into replicated_database_improvements 2022-07-06 19:54:53 +02:00
Alexander Tokmakov
30e9104b6e ignore cluster if equals to db name 2022-07-06 19:54:05 +02:00
Igor Nikonov
810926c7fc Rename setting after_rewrite -> rewrite 2022-07-06 17:29:30 +00:00
Alexander Tokmakov
3a94ae8f67 normalize CREATE ON CLUSTER on initiator 2022-07-06 18:50:00 +02:00
vdimir
b27d3ec5ce
Fix build 2022-07-06 15:11:23 +00:00
vdimir
2fd229448c
Fix style FullSortingMergeJoin.h 2022-07-06 14:28:06 +00:00
vdimir
7c586a9e7c
Minor updates for full soring merge join 2022-07-06 14:28:05 +00:00
vdimir
881d352e05
upd full sorting join 2022-07-06 14:28:05 +00:00
vdimir
0b994bb258
fix build 2022-07-06 14:27:32 +00:00
vdimir
c8cd962bac
couple of tests for full_sorting_merge 2022-07-06 14:27:31 +00:00
vdimir
c200ce490b
full sorting join using and nulls 2022-07-06 14:27:30 +00:00
vdimir
753a567da8
full sorting join with using 2022-07-06 14:27:29 +00:00
vdimir
d184e184b4
full sort join: check key types, more tests 2022-07-06 14:26:19 +00:00
vdimir
4e88e8f5ec
full sort join: move block list to all join state 2022-07-06 14:26:17 +00:00
vdimir
6d198ff3d7
fix style 2022-07-06 14:25:11 +00:00
vdimir
d34a66c915
wip sorting merge 2022-07-06 14:25:09 +00:00
vdimir
1b429fc1af
wip: any left/right sorting join 2022-07-06 14:23:46 +00:00
vdimir
4a16195964
Calculate output header for full sorting merge join 2022-07-06 14:23:45 +00:00
vdimir
2a0e497ced
Rename enumerators in JoinPipelineType 2022-07-06 14:23:45 +00:00
vdimir
fa8eb35599
Pipeline for full sorting merge join 2022-07-06 14:23:44 +00:00
Igor Nikonov
f1bec4ef21 EXPLAIN AST option after_rewrite 2022-07-06 14:21:59 +00:00
Maksim Kita
b94489d52c
Merge pull request #38859 from kitaisreal/merge-tree-merge-disable-batch-optimization
MergeTree merge disable batch optimization
2022-07-06 15:59:40 +02:00
Vladimir C
3c7fdb604d
Merge pull request #35363 from vdimir/kv-join 2022-07-06 15:57:30 +02:00
Nikolai Kochetov
65cd0cc61c Fixing style. 2022-07-06 13:44:06 +00:00
Igor Nikonov
9ca08f8fda Continue: ContextPtr -> const ContextPtr & in parameters 2022-07-06 13:13:19 +00:00
Nikolai Kochetov
f63b27498f Add additional_result_filter setting. 2022-07-06 12:37:37 +00:00
Ilya Yatsishin
1863fb82f6
Merge pull request #38814 from qoega/otel-debug
Use native Map type for OpenTelemetry attributes
2022-07-06 14:33:56 +02:00
Igor Nikonov
059c5c0f0a Simple cleanup: context ptr usage in interpreters 2022-07-06 12:29:20 +00:00
mergify[bot]
0f3965b258
Merge branch 'master' into order_by_with_braces 2022-07-06 10:27:22 +00:00
Igor Nikonov
a0f6f6f82d Fix: rewrite only outer braces 2022-07-06 10:23:05 +00:00
Igor Nikonov
5a01c27eb1 Fix: clear children in order by element during rewriting
- remove unnecessary code for this PR
2022-07-05 22:48:48 +00:00
Igor Nikonov
fd62494a77 Fix: ORDER BY with braces inefficient execution 2022-07-05 22:48:48 +00:00
Igor Nikonov
99de1ee109 Simple cleanup: interpreters and parsers 2022-07-05 22:13:39 +00:00
kssenii
e55169ebad Fix 2022-07-05 20:15:35 +02:00
Yatsishin Ilya
e9b7f52874 another one 2022-07-05 17:36:45 +00:00
Maksim Kita
bdc21737d5 MergeTree merge disable batch optimization 2022-07-05 16:15:00 +02:00
Nikolai Kochetov
659a6452f5 Added SettingMap. Use Map for additional_table_filters. 2022-07-05 13:10:09 +00:00
vdimir
0232c9267d
Pass CHPC_DATABASE_URL to perf tests 2022-07-05 14:00:15 +02:00
Yatsishin Ilya
f39ce7e668 Merge remote-tracking branch 'origin' into otel-debug 2022-07-05 11:30:36 +00:00
vdimir
17903117d2
better 2022-07-05 10:46:08 +00:00
Kruglov Pavel
a6a9824261
Merge pull request #38362 from Avogar/better-exception-messages
Better exception messages on wrong table engines/functions argument types
2022-07-05 11:21:44 +02:00
kssenii
b52084265c Merge master 2022-07-04 21:37:43 +02:00
vdimir
c0cb588e45
Fix build 2022-07-04 17:28:34 +00:00
vdimir
43afda408b
do not call setStorageJoin when setting isn't set 2022-07-04 17:28:15 +00:00
vdimir
65ac97ce89
direct join: handle nullable, add tests 2022-07-04 17:28:14 +00:00
vdimir
0c12adc934
fix style 2022-07-04 17:28:14 +00:00
vdimir
e40f799f96
handle right rey rename in direct join 2022-07-04 17:28:13 +00:00
vdimir
87794f9b5b
get/setTotas to IJoin 2022-07-04 17:28:13 +00:00
vdimir
a1388813e4
fix src/Interpreters/ExpressionAnalyzer.cpp 2022-07-04 17:28:12 +00:00
vdimir
8359753a85
Move DirectJoin to separate file 2022-07-04 17:28:11 +00:00
vdimir
51a6c347ad
make join_alorithm settings with multiple choices 2022-07-04 17:28:11 +00:00
vdimir
0dfd400f51
check conditions before using direct join 2022-07-04 17:28:10 +00:00
vdimir
085e70c7a3
wip left kvjoin 2022-07-04 17:28:10 +00:00
vdimir
980000d04c
Change getByKeys, add StorageEmbeddedRocksDB::getByKeysImpl 2022-07-04 17:28:09 +00:00
vdimir
744c692be3
wip key value join 2022-07-04 17:28:09 +00:00
Ilya Yatsishin
867b3aa873 fix 2022-07-04 18:01:24 +02:00
Dmitry Novik
e179449381 Fix some tests 2022-07-04 15:56:42 +00:00
Ilya Yatsishin
f871cbc7d5
Update src/Interpreters/OpenTelemetrySpanLog.cpp
Co-authored-by: Dmitry Novik <d1mas1k4@yandex.ru>
2022-07-04 17:52:06 +02:00
Dmitry Novik
c66e2c8095
Merge pull request #37155 from amosbird/projection-fix-two
Fix intermediate header in aggregate projection
2022-07-04 16:32:34 +02:00
Yatsishin Ilya
b4e62e06e7 Use native Map 2022-07-04 14:07:29 +00:00
Kruglov Pavel
6c4b6fa834
Merge branch 'master' into better-exception-messages 2022-07-04 15:07:31 +02:00
Alexander Tokmakov
2e073b5cff Merge branch 'master' into replicated_database_improvements 2022-07-04 13:53:47 +02:00
lingpeng0314
cca94f01ae add function tryGetKeeperDispatcher for context
- to make sure other case will get error if dispatcher not initialized
2022-07-04 13:35:08 +08:00
Alexey Milovidov
c711012399
Merge pull request #38731 from azat/views-max_insert_threads
Fix number of threads for pushing to views
2022-07-04 07:43:26 +03:00
Igor Nikonov
2e2ef08712
Merge pull request #37803 from ClickHouse/dictinct_in_order_optimization
DISTINCT in order optimization
2022-07-03 21:59:04 +02:00
Azat Khuzhin
dd3515da98 Fix parallel_view_processing with optimize_trivial_insert_select=1 2022-07-03 15:14:05 +03:00
Azat Khuzhin
4ae7db8369 Fix max_insert_threads while pushing to views
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-07-03 15:14:05 +03:00
mergify[bot]
12f5250e86
Merge branch 'master' into dictinct_in_order_optimization 2022-07-01 22:51:35 +00:00
Maksim Kita
8177608860 SQL create drop index fix formatting 2022-07-01 22:35:20 +02:00
Yakov Olkhovskiy
776a80bff8
Merge pull request #38136 from bigo-sg/translate_qualified_bug
Bug fixed in TranslateQualifiedNamesMatcher
2022-07-01 14:07:00 -04:00
Anton Popov
ef87e1207c better support of read_in_order in case of fixed prefix of sorting key 2022-07-01 16:45:01 +00:00
Dmitry Novik
81dd90893e Merge remote-tracking branch 'origin/master' into group-by-use-nulls 2022-07-01 16:24:05 +00:00
Amos Bird
53f47127e9
Fix only_merge header 2022-07-01 23:31:45 +08:00
Nikolai Kochetov
b7529986c0 Use separate counter for RSS in global memory tracker. 2022-07-01 12:09:32 +00:00
Yatsishin Ilya
202008e80b Add asserts 2022-07-01 11:00:04 +00:00
Vitaly Baranov
cadb496894
Merge pull request #38537 from vitlibar/backup-improvements-8
Backup Improvements 8
2022-07-01 11:20:46 +02:00
lingpeng0314
03a5ce542d Remove Exception in getKeeperDispatcher
- to handle the nil case by caller
2022-07-01 11:27:40 +08:00
lgbo-ustc
bab954c461 update codes based on review comment 2022-07-01 10:15:35 +08:00
Dmitry Novik
33f601ec0a Commit support use_nulls for GS 2022-06-30 15:14:26 +00:00
Vitaly Baranov
e367d96964 Fix style. 2022-06-30 15:10:33 +02:00
Igor Nikonov
488ee75fc4 + use DistinctSorted for final distinct step
+ fix performance tests
2022-06-30 13:03:39 +00: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
Kruglov Pavel
57686b8422
Merge pull request #38561 from kitaisreal/sql-create-drop-index-update
SQL create drop index minor fixes
2022-06-30 13:38:39 +02:00
Dmitry Novik
98e9bc84d5 Refector ROLLUP and CUBE 2022-06-30 10:13:58 +00:00
alesapin
be213c0be7
Merge pull request #38590 from ClickHouse/proper_fix
Proper fix for ipv4/ipv6 conversion error
2022-06-30 11:15:01 +02:00
Vitaly Baranov
aa97bf5125 Improve handling predefined databases and tables. 2022-06-30 08:37:17 +02:00
mergify[bot]
4cbbfb431d
Merge branch 'master' into dictinct_in_order_optimization 2022-06-29 23:32:17 +00:00
Igor Nikonov
d435532c68 Adapt range search algorithm to high cardinality case
+ range search done in steps of some number of rows.
  Controled by new
  setting `distinct_in_order_range_search_step`. By default 0, i.e.
  whole chunk
+ before start binary search, linear probing is done on each step (32
  rows currently)
2022-06-29 23:30:35 +00:00
Dmitry Novik
4f7967ab9e
Merge pull request #37887 from azat/union-fix
Fix incorrect columns order in subqueries of UNION
2022-06-29 20:40:23 +02:00
alesapin
8f5582f95e Review and style fixes 2022-06-29 20:29:50 +02:00
alesapin
62e7a89f26 Proper fix for ipv4/ipv6 conversion error 2022-06-29 17:53:08 +02:00
Alexander Tokmakov
894acf0c5c fix tests 2022-06-29 16:27:21 +02:00
mergify[bot]
36139eacd7
Merge branch 'master' into dictinct_in_order_optimization 2022-06-29 13:37:16 +00:00
Alexander Tokmakov
c6c22409a2 Merge branch 'master' into replicated_database_improvements 2022-06-29 14:38:07 +02:00
Anton Popov
e78814f3bb
Merge pull request #38371 from CurtizJ/fix-distint-with-limit
Fix `DISTINCT` with `LIMIT` in distributed queries
2022-06-29 14:02:41 +02:00
Maksim Kita
eeae73e0cf SQL create drop index update implementation 2022-06-29 13:10:30 +02:00
mergify[bot]
1280fc39a0
Merge branch 'master' into better-exception-messages 2022-06-29 11:09:06 +00:00
Alexander Tokmakov
c3573532c0
Merge pull request #38487 from ClickHouse/add_some_tsa_annotations
Add some TSA annotations
2022-06-29 13:57:10 +03:00
Alexander Tokmakov
ceb66ade4b
Merge pull request #38335 from ClickHouse/deprecate_ordinary_database
Deprecate Ordinary database and old *MergeTree syntax
2022-06-29 13:42:59 +03:00
Maksim Kita
23e09b5e9b
Merge pull request #35166 from zhangjmruc/sql_compatible_create_drop_index
Support SQL compatible create/drop index syntax
2022-06-29 12:30:28 +02:00
Robert Schulze
bb441faa42
Merge pull request #38491 from ClickHouse/clang-tidy-in-branches
Fix some clang-tidy warnings in headers
2022-06-29 10:22:04 +02:00
Alexey Milovidov
4cda5491f6
Merge pull request #38542 from ClickHouse/unique_lock-to-lock_guard
Don't use std::unique_lock unless we need to
2022-06-29 09:40:56 +03:00
jianmei zhang
8d49aa4697 Support sql standard drop index in seprate parser files 2022-06-29 11:08:05 +08:00
jianmei zhang
589cba8045 Support sql standard create index in seprate parser files 2022-06-29 11:08:05 +08:00
Jianmei Zhang
4d0635371f Support sql stanard create and drop index 2022-06-29 11:08:05 +08:00
Nikita Taranov
f5d26572df
Quick fix for aggregation pipeline (#38295) 2022-06-29 01:16:30 +02:00
Azat Khuzhin
f86ddebada Add sanity check for UNION header
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-28 22:53:03 +03:00
Azat Khuzhin
d98336ad83 Fix incorrect columns order in subqueries of UNION
Consider the following query:

    SELECT avgWeighted(x, y) FROM (SELECT NULL, 255 AS x, 1 AS y UNION ALL SELECT y, NULL AS x, 1 AS y)

Here is UNION from two SELECT queries
- `SELECT NULL, 255 AS x, 1 AS y`
- `SELECT y, NULL AS x, 1 AS y`

UNION queries matches columns by positions, not names, so the following
columns should be used by `avgWeighted()`:
- `255 AS x,  1 AS y`
- `NULL AS x, 1 AS y`

Result types of arguments should be:
- `x Nullable(UInt8)`
- `y UInt8`

And in case of UNION query is a subselect itself, it will return only
required columns, for the example above it needs only `x` and `y`.
For this it will get positions of these arguments from the first query,
and then use those positions to get required column names from the
second query (since there is no ability to get columns by positions
instead of names internally), and due to duplicated columns the second
query will return (`y`, `x`) not (`x`, `y`), and this will make the
result incorrect:

    EXPLAIN header = 1, optimize = 0, actions=1 SELECT avgWeighted(x, y) FROM (SELECT NULL, 255 AS x, 1 AS y UNION ALL SELECT y, NULL AS x, 1 AS y)

    Aggregates:
        avgWeighted(x, y)
          Function: avgWeighted(Nullable(UInt8), UInt8) → Nullable(Float64)
          Arguments: x, y
          Argument positions: 0, 1
      Expression (Before GROUP BY)
      Header: x UInt8
              y Nullable(UInt8)
      ...
      Union
      Header: x UInt8
              y Nullable(UInt8)
        Expression (Conversion before UNION)
        Header: x UInt8
                y Nullable(UInt8)
        Expression (Conversion before UNION)
        Header: x UInt8
                y Nullable(UInt8)

And the query itself fails with an error:

    Logical error: 'Bad cast from type DB::ColumnVector<char8_t> to DB::ColumnNullable'.

_NOTE: `avgWeighted()` here is required to trigger `LOGICAL_ERROR`_

CI: https://s3.amazonaws.com/clickhouse-test-reports/37796/e637489f81768df582fe7389e57f7ed12893087c/fuzzer_astfuzzerdebug,actions//report.html
Fixes: 02227_union_match_by_name
v2: fix untuple() (reserve space for output_columns_positions too)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-28 22:53:03 +03:00
Azat Khuzhin
ee0f2651ee Revert "Fix converting types for UNION queries (may produce LOGICAL_ERROR)"
This fix is incorrect, and it introduce new issues, in particular it
may breaks UNION queries w/o column aliases, i.e.:

    SELECT a, b, c FROM (SELECT 3 AS a, 2147483647 AS b, 1048575 AS c UNION ALL SELECT -2, NULL, -2) AS js1 ORDER BY a

CI: https://s3.amazonaws.com/clickhouse-test-reports/37796/e637489f81768df582fe7389e57f7ed12893087c/fuzzer_astfuzzerdebug,actions//report.html
Reverts: #37593/#34775 (2613149f6b)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-28 22:50:01 +03:00
Robert Schulze
f692ead6ad
Don't use std::unique_lock unless we have to
Replace where possible by std::lock_guard which is more light-weight.
2022-06-28 19:19:06 +00:00
Alexander Tokmakov
4f54abf67f better names for macros 2022-06-28 16:27:18 +02:00
Alexander Tokmakov
021bdc335e Merge branch 'master' into add_some_tsa_annotations 2022-06-28 15:42:01 +02:00
Alexander Tokmakov
428628238f Merge branch 'master' into deprecate_ordinary_database 2022-06-28 15:40:33 +02:00
Robert Schulze
c22038d48b
More clang-tidy fixes 2022-06-28 11:50:05 +00:00
mergify[bot]
ea416c877f
Merge branch 'master' into better-exception-messages 2022-06-28 11:13:26 +00:00
Alexander Tokmakov
09a0688d80 fix 2022-06-28 00:26:52 +02:00
Alexander Tokmakov
851534c9f7 Merge branch 'master' into deprecate_ordinary_database 2022-06-27 23:47:49 +02:00
Alexander Tokmakov
f4883f1f7e add some TSA aanotations 2022-06-27 22:48:27 +02:00
mergify[bot]
a9c1b68034
Merge branch 'master' into dictinct_in_order_optimization 2022-06-27 20:16:00 +00:00
Dmitry Novik
b629d557ce
Merge pull request #38246 from ClickHouse/overcommit-deadlock-fix
Fix deadlock in OvercommitTracker logging
2022-06-27 21:57:31 +02:00
Dmitry Novik
1d15d72211 Support NULLs in ROLLUP 2022-06-27 18:42:26 +00:00
Nikolai Kochetov
6824570ea3 Fix style. 2022-06-27 18:10:29 +00:00
Nikolai Kochetov
99436ab1da Remove unneeded code. 2022-06-27 17:46:09 +00:00
Nikolai Kochetov
79cf4c4f7e Remove commented code. 2022-06-27 17:44:30 +00:00
Nikolai Kochetov
1d5ba77c87 Fix test. 2022-06-27 17:41:55 +00:00
Alexander Tokmakov
2283436d24
Merge pull request #38344 from Algunenano/implicit_transactions
Add implicit_transaction setting
2022-06-27 18:50:37 +03:00
Alexander Tokmakov
88dbbcb15d fix tests 2022-06-27 16:10:00 +02:00
Alexander Tokmakov
bec921c9d9
Merge pull request #38265 from ClickHouse/cleanup_garbage_in_store_dir
Add background cleanup of store/ subdirs
2022-06-27 16:53:13 +03:00
Alexander Tokmakov
7c37079a96 Merge branch 'master' into deprecate_ordinary_database 2022-06-27 14:46:59 +02:00
Anton Kozlov
5f81bcd84f
CLICKHOUSE-1331 Rewrite tuple functions as literals in backwards-compatibility mode (#38096)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
2022-06-27 14:13:21 +02:00
kssenii
5c26f99bc5 Merge master 2022-06-27 13:36:41 +02:00
Nikita Taranov
2487ba7f00
Move updateInputStream to ITransformingStep (#37393) 2022-06-27 13:16:52 +02:00
mergify[bot]
da52780cb5
Merge branch 'master' into implicit_transactions 2022-06-27 09:46:34 +00:00
mergify[bot]
f63c959679
Merge branch 'master' into cleanup_garbage_in_store_dir 2022-06-26 13:35:10 +00:00
Igor Nikonov
aca6a6f1b0 Merge remote-tracking branch 'origin/master' into dictinct_in_order_optimization 2022-06-26 09:45:59 +00:00
Alexey Milovidov
a45e3d47ad Remove useless codec from system.asynchronous_metric_log 2022-06-25 07:16:25 +02:00
mergify[bot]
b65cf4e1fe
Merge branch 'master' into dictinct_in_order_optimization 2022-06-24 22:52:14 +00:00
kssenii
708b93a03b Merge master 2022-06-25 00:08:24 +02:00
Alexander Gololobov
189d0fffb8
Merge pull request #37165 from ClickHouse/merge_tree_reader
Merge tree reader support for multiple read/filter steps: row level filter, prewhere, ...
2022-06-24 21:32:31 +02:00
Alexander Tokmakov
94dd80e900 fix tests 2022-06-24 19:10:33 +02:00
Alexander Tokmakov
31dcc7634e Merge branch 'master' into deprecate_ordinary_database 2022-06-24 18:16:07 +02:00
Alexander Tokmakov
59a14d2a50 add docs 2022-06-24 17:34:41 +02:00
Alexander Tokmakov
379fecf7f9 try suppress failures with MaterializedPostgreSQL 2022-06-24 17:15:15 +02:00
Raúl Marín
072f64c800 Improvements based on review 2022-06-24 16:54:47 +02:00
mergify[bot]
36b93772b9
Merge branch 'master' into merge_tree_reader 2022-06-24 13:22:53 +00:00
Anton Popov
a2158066f2 fix distinct with limit in distributed queries 2022-06-24 02:32:40 +00:00
mergify[bot]
a0eb831cd1
Merge branch 'master' into overcommit-deadlock-fix 2022-06-23 23:02:59 +00:00
avogar
59c1c472cb Better exception messages on wrong table engines/functions argument types 2022-06-23 20:04:06 +00:00
Alexander Tokmakov
74f38710a8 Merge branch 'master' into cleanup_garbage_in_store_dir 2022-06-23 21:43:28 +02:00
kssenii
6fbd49f554 Merge master 2022-06-23 21:40:01 +02:00
Alexander Tokmakov
dbf2763788 automatically convert system database to Atomic 2022-06-23 21:38:43 +02:00
Kseniia Sumarokova
40a4742f93
Merge pull request #38319 from kssenii/fix-access-for-drop-fs-cache
Add access check and on cluster option for system drop fs cache
2022-06-23 20:56:44 +02:00
kssenii
468c98ff42 Better 2022-06-23 17:46:27 +02:00
mergify[bot]
174d8577fa
Merge branch 'master' into merge_tree_reader 2022-06-23 15:16:51 +00:00
Raúl Marín
7f7d082fb3 Add implicit_transaction setting 2022-06-23 15:23:37 +02:00
kssenii
f7b329ee57 Merge master 2022-06-23 14:56:48 +02:00
mergify[bot]
b5d3fd50d2
Merge branch 'master' into dictinct_in_order_optimization 2022-06-23 09:48:38 +00:00
Alexander Tokmakov
2c5a88faba deprecate Ordinary database 2022-06-23 10:20:14 +02:00
Antonio Andelic
a5ee918bd2
Merge pull request #38047 from ClickHouse/keeper-sequential-consistency-reads
Add `SYNC` command to internal ZooKeeper client
2022-06-23 08:43:24 +02:00
kssenii
e40d9bcf55 Merge master 2022-06-22 23:28:52 +02:00
Anton Popov
52db1b35a1 improve performace of insertion to columns of type JSON 2022-06-22 17:45:51 +00:00
Alexander Tokmakov
ed8341025b make code less bad 2022-06-22 18:31:42 +02:00
kssenii
dce1c76270 Fix 2022-06-22 18:00:25 +02:00
Alexander Gololobov
a5b3f83181 Always remove row filter column 2022-06-22 17:23:09 +02:00
Alexander Gololobov
6a26325fab Test dirty hacks for multiple PREWHERE steps 2022-06-22 17:23:05 +02:00
Alexander Tokmakov
31c4f83469
Merge pull request #38272 from ClickHouse/create_empty_as_select
Support CREATE ... EMPTY AS SELECT
2022-06-22 13:25:12 +03:00
Nikolai Kochetov
cc6fdfe0eb
Merge pull request #36555 from ClickHouse/refactor-something-in-part-volumes
Separate data storage abstraction for MergeTree
2022-06-22 11:13:36 +02:00
Alexander Tokmakov
dc1f596326 fix 2022-06-22 00:50:16 +02:00
mergify[bot]
f45b4f56d8
Merge branch 'master' into dictinct_in_order_optimization 2022-06-21 21:25:37 +00:00
Igor Nikonov
b0a98bd875 DISTINCT in order optimization
+ use SortDescription from input data stream in DistinctStep to decide if the optimization is applicable
2022-06-21 21:23:49 +00:00
Anton Popov
d5d568e235
Merge pull request #37913 from azat/parts-refcnt
Fix refcnt for unused MergeTree parts in SELECT queries
2022-06-21 22:56:26 +02:00
kssenii
4178abc0a5 Merge master 2022-06-21 22:38:51 +02:00
kssenii
90ce0b44f0 Fixes 2022-06-21 21:03:18 +02:00
kssenii
481644939a Add describe cache command 2022-06-21 16:07:39 +02:00
Alexander Tokmakov
13e3d40db4 fix 2022-06-21 15:11:03 +02:00
Alexander Tokmakov
f3ea8ad745 support CREATE EMPTY AS SELECT 2022-06-21 15:03:58 +02:00
Nikolai Kochetov
543782436d Process additional filters. 2022-06-21 11:24:46 +00:00
Nikolai Kochetov
1e8c9ecd4c Merge branch 'master' into refactor-something-in-part-volumes 2022-06-21 12:37:21 +02:00
Alexander Tokmakov
ba0fcec993 add background cleanup of store/ subdirs 2022-06-21 12:35:47 +02:00
Nikolai Kochetov
b8d27aa8dd
Merge pull request #37469 from azat/projections-optimize_aggregation_in_order
Implement in order aggregation (optimize_aggregation_in_order) for projections for tables with fully materialized projections
2022-06-21 12:17:35 +02:00
mergify[bot]
bdd5b94192
Merge branch 'master' into keeper-sequential-consistency-reads 2022-06-21 08:13:04 +00:00
lingpeng0314
c18dd55400 Resolve comments
- refine metric description
2022-06-21 10:30:19 +08:00
Nikolai Kochetov
dccf90b1ea Cleanup. 2022-06-20 18:18:17 +00:00
mergify[bot]
9bdd9e14a6
Merge branch 'master' into fix_flaky_tests_with_transactions 2022-06-20 18:11:30 +00:00
Dmitry Novik
f6692c34e6
Merge pull request #34632 from excitoon-favorites/optimizedprocessing
Optimized processing of ORDER BY in window functions
2022-06-20 20:03:26 +02:00
Dmitry Novik
53d656d89f Fix deadlock in OvercommitTracker logging 2022-06-20 17:35:24 +00:00
Antonio Andelic
777ae72259 Merge branch 'master' into keeper-sequential-consistency-reads 2022-06-20 14:06:45 +00:00
Antonio Andelic
df31b562ec Use sync after reconnect to avoid stale reads 2022-06-20 14:05:51 +00:00
Nikolai Kochetov
7452d04e3a Merge branch 'master' into refactor-something-in-part-volumes 2022-06-20 15:31:02 +02:00
kssenii
90be49faa4 Merge master 2022-06-20 14:26:56 +02:00
Dmitry Novik
77177917bd
Merge pull request #37848 from ClickHouse/window-function-expression
Support expressions with window functions
2022-06-20 14:21:13 +02:00
Vitaly Baranov
06c4082a7c
Merge pull request #37358 from vitlibar/backup-improvements-6
Backup Improvements 6
2022-06-20 14:13:30 +02:00
mergify[bot]
4ed606a275
Merge branch 'master' into fix_flaky_tests_with_transactions 2022-06-20 10:17:51 +00:00
Igor Nikonov
6ac68e8303 DISTINCT in order optimization
+ optimization for DISTINCT containing primary key columns
2022-06-20 10:06:15 +00:00
lingpeng0314
1d463718ca Change getKeeperDispatcher error type 2022-06-20 17:11:15 +08:00
lingpeng0314
f06b19bdbf Add keeper monitoring data 2022-06-20 11:32:18 +08:00
Vladimir Chebotarev
bfb67ded2c Rebase fix. 2022-06-20 05:15:08 +03:00
Vladimir Chebotarev
b81df2be83 Update src/Interpreters/ExpressionAnalyzer.cpp
Co-authored-by: Dmitry Novik <d1mas1k4@yandex.ru>
2022-06-20 05:15:08 +03:00
Vladimir Chebotarev
7f9557f8a3 Added optimize_read_in_window_order setting. 2022-06-20 05:15:07 +03:00
Vladimir Chebotarev
ec22f6d539 Draft. 2022-06-20 05:15:07 +03:00
Vitaly Baranov
638ea23399 Fix build. 2022-06-20 03:44:59 +02:00
mergify[bot]
670a63865e
Merge branch 'master' into window-function-expression 2022-06-19 22:14:54 +00:00
Vitaly Baranov
8a7c970ce0 Fix style. 2022-06-19 15:58:26 +02:00
alesapin
50801e41c5 Merge branch 'master' into refactor-something-in-part-volumes 2022-06-19 14:05:46 +02:00
Vitaly Baranov
01aaaf7395 More accurate access checking for RESTORE. 2022-06-19 11:26:41 +02:00
Antonio Andelic
dd75e9cba5
Merge pull request #38149 from vdimir/multiple_joins_original_names_34697
Add setting multiple_joins_try_to_keep_original_names
2022-06-18 14:47:31 +02:00
Dmitry Novik
8b917d12f2 Small refactoring 2022-06-18 01:40:30 +00:00
Maksim Kita
7e759cac39
Merge pull request #38184 from kitaisreal/sql-user-defined-function-loader-allow-symlinks
SQLUserDefinedFunctionsLoader allow symlinks in user_defined directory
2022-06-17 23:03:52 +02:00
Antonio Andelic
f72e509b3b
Merge pull request #38052 from amosbird/join_regression_fix
Fix significant join performance regression
2022-06-17 19:55:33 +02:00
Maksim Kita
965b706350 SQLUserDefinedFunctionsLoader allow symlinks in user_defined directory 2022-06-17 17:43:42 +02:00
Alexander Tokmakov
e9c2157f01 Merge branch 'master' into fix_flaky_tests_with_transactions 2022-06-17 15:57:30 +02:00
Alexander Gololobov
f69f24ffbd
Merge pull request #38135 from vdimir/issue_37928
Try to fix temporary name clash in partial merge join
2022-06-17 15:10:19 +02:00
Alexander Tokmakov
5ffc38d9b9 fix style check, add comments 2022-06-17 13:47:14 +02:00
Maksim Kita
77c519ae08
Merge pull request #38142 from kitaisreal/executable-user-defined-functions-parameters-direct-fix
Disable parameters for non direct executable user defined functions
2022-06-17 12:57:27 +02:00
alesapin
1c7a7da487
Merge pull request #38088 from kssenii/diff-with-cache
Extract some diff from pr #36171
2022-06-17 12:07:31 +02:00
lgbo-ustc
308ca62518 fixed bugs 2022-06-17 15:37:54 +08:00
lgbo-ustc
4a0a6e8cde small optimization 2022-06-17 15:17:56 +08:00