Commit Graph

6805 Commits

Author SHA1 Message Date
Nikolai Kochetov
2a9a63ac7b Merge branch 'master' into refactor-something-in-part-volumes 2022-06-15 15:35:26 +02:00
Danila Kutenin
08e3f77a9c Optimize most important parts with NEON SIMD
First part, updated most UTF8, hashing, memory and codecs. Except
utf8lower and upper, maybe a little later.

That includes huge amount of research with movemask dealing. Exact
details and blog post TBD.
2022-06-15 13:19:29 +00:00
Yakov Olkhovskiy
e604d31feb
Merge pull request #38074 from ClickHouse/bug-with-fill-extra
Inconsistency in ORDER BY ... WITH FILL feature.
2022-06-15 08:19:55 -04:00
mergify[bot]
2cb9579234
Merge branch 'master' into join_regression_fix 2022-06-15 11:53:42 +00:00
Yakov Olkhovskiy
411695bd97 do not fill 'to' boundary 2022-06-14 22:26:50 -04:00
Alexander Tokmakov
b39bd3c4e0 fix 2022-06-14 16:11:16 +02:00
Amos Bird
9a6e6ccfaf
Fix significant join performance regression 2022-06-14 21:14:18 +08:00
Maksim Kita
da8b1b1eba
Merge pull request #38025 from kitaisreal/use-base-sort-instead-of-standard
Use pdqsort instead of standard sort
2022-06-14 12:13:35 +02:00
Dmitry Novik
eddd4ecaeb Allow several functions in window expression 2022-06-14 00:57:33 +00:00
Dmitry Novik
0c6ed20b42 Fix window expression evaluation 2022-06-13 23:11:53 +00:00
Antonio Andelic
b9cf6fe367 Merge branch 'master' into pp-system-unfreeze 2022-06-13 14:46:30 +00:00
Maksim Kita
98a89b50ff Use pdqsort instead of standard sort 2022-06-13 15:31:08 +02:00
mergify[bot]
9e0d16f21d
Merge branch 'master' into window-function-expression 2022-06-10 15:31:53 +00:00
Kseniia Sumarokova
580a30c6ae
Merge pull request #37859 from KinderRiven/support_max_request_cache_size
Support to set max cache size for per query in local cache
2022-06-10 16:17:18 +02:00
Robert Schulze
5f5732a2c4
Merge pull request #37969 from ClickHouse/consistent-macro-usage
More consistent use of platform macros
2022-06-10 14:10:01 +02:00
Kseniia Sumarokova
508676ab4e
Merge pull request #37804 from ClickHouse/metadata_storage
Metadata storage abstraction for Disks
2022-06-10 11:43:28 +02:00
Robert Schulze
1a0b5f33b3
More consistent use of platform macros
cmake/target.cmake defines macros for the supported platforms, this
commit changes predefined system macros to our own macros.

__linux__ --> OS_LINUX
__APPLE__ --> OS_DARWIN
__FreeBSD__ --> OS_FREEBSD
2022-06-10 10:22:31 +02:00
Alexander Tokmakov
780f7c87c7
Merge pull request #36113 from ClickHouse/remove-useless-code-2
Remove useless code in ReplicatedMergeTreeRestartingThread
2022-06-09 17:56:28 +03:00
Ilya Yatsishin
d6427f56f3
Opentracing minimal changes for processors (#37837) 2022-06-09 14:43:50 +02:00
alesapin
84ab147155 Merge branch 'master' into metadata_storage 2022-06-08 22:33:12 +02:00
Vadim Volodin
637d293fbd Add SYSTEM UNFREEZE query 2022-06-08 15:21:14 +03:00
Nikolai Kochetov
5bc9b32025 Merge branch 'master' into refactor-something-in-part-volumes 2022-06-08 11:10:06 +00:00
KinderRiven
6883ecda96 fix 2022-06-08 14:19:50 +08:00
Azat Khuzhin
61a2613127 Fix refcnt for unused MergeTree parts in SELECT queries
Before this patch SELECT queries hold parts even if they were not
required by select (had been eliminated by partition pruning).

This defers removing parts if you have long running queries.

This had been introduced in #23932, with introduction of
StorageSnapshotPtr.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-08 07:04:53 +03:00
Nikolai Kochetov
678d978acf Merge branch 'master' into refactor-something-in-part-volumes 2022-06-07 15:23:00 +00:00
mergify[bot]
2d01abf871
Merge branch 'master' into revert-37647-Fix-all-CheckTriviallyCopyableMove-Errors 2022-06-07 13:32:30 +00:00
Igor Nikonov
dcad154105
Merge pull request #37866 from ClickHouse/igor_minor_cleanup
Minor cleanup
2022-06-07 15:24:56 +02:00
Anton Popov
df6882d2b9
Revert "Fix errors of CheckTriviallyCopyableMove type" 2022-06-07 13:53:10 +02:00
Vladimir C
1c184a7e18
Merge pull request #37840 from azat/join-query-fatal-errors 2022-06-07 12:07:37 +02:00
Kseniia Sumarokova
4272ca8836
Merge pull request #36060 from Varinara/master
Add feature disks (ls, C, list-disks, disk, help)
2022-06-07 11:22:23 +02:00
Vitaly Baranov
d199478169
Merge pull request #37303 from ClickHouse/fix_trash
Try to fix some trash
2022-06-07 10:17:39 +02:00
KinderRiven
3b2a427002 fix 2022-06-07 11:50:56 +08:00
mergify[bot]
7a76a7a606
Merge branch 'master' into master 2022-06-06 19:44:32 +00:00
Anton Popov
d40b23272e
Merge pull request #37755 from CurtizJ/fix-mutations-again
Return back #37266
2022-06-06 20:22:03 +02:00
Maksim Kita
612172def5
Merge pull request #37720 from kitaisreal/executable-user-defined-functions-parameters
Executable user defined functions support parameters
2022-06-06 16:51:56 +02:00
Varinara
ed6e8176fe Add basic commands for disk tool (list-disks, list, move, remove, link, copy, read, write) + tests 2022-06-06 16:52:58 +03:00
KinderRiven
13e74bef5e support skip_download_if_exceeds_query_cache 2022-06-06 02:36:23 +08:00
Robert Schulze
2d87af2a15
Merge pull request #37647 from DevTeamBK/Fix-all-CheckTriviallyCopyableMove-Errors
Fix errors of CheckTriviallyCopyableMove type
2022-06-05 19:58:47 +02:00
Igor Nikonov
13149dc094 Minor cleanup 2022-06-05 14:31:07 +00:00
KinderRiven
3ffb0b3549 support_max_query_cache_size 2022-06-05 16:21:36 +08:00
Dmitry Novik
58d79f8eed Support expressions with window functions 2022-06-04 02:01:49 +00:00
Maksim Kita
d14193b3ad Executable user defined functions extract parameters name and type from command value 2022-06-03 18:06:59 +02:00
Maksim Kita
6c5ec68a7c Executable user defined functions support parameters 2022-06-03 18:05:37 +02:00
Azat Khuzhin
c29768325c Print query in one line on fatal errors
executeQuery() logging query without new lines in SQL, and it is useful,
since you can grep and see the whole query (usually).

So let's use the same in fatal error handler to make CI reports more
informative.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-03 18:55:53 +03:00
mergify[bot]
ddf7210ecc
Merge branch 'master' into remove-useless-code-2 2022-06-03 13:58:45 +00:00
mergify[bot]
70c4968cc5
Merge branch 'master' into metadata_storage 2022-06-03 13:25:31 +00:00
Anton Popov
3ace077401
Merge pull request #37695 from CurtizJ/replace-multiif-to-if
Replace `multiIf` to `if` in case of one condition
2022-06-03 14:56:43 +02:00
alesapin
ac03e3af3e
Merge branch 'master' into metadata_storage 2022-06-03 14:42:21 +02:00
alesapin
5d30a4ef09 Fix typos and buge 2022-06-03 14:35:15 +02:00
Anton Popov
5cf2c67410
Merge branch 'master' into fix-mutations-again 2022-06-03 14:17:05 +02:00
Nikolai Kochetov
176af473c3 Fix build. 2022-06-02 19:38:47 +00:00
Nikolai Kochetov
8991f39412 Merge branch 'master' into refactor-read-metrics-and-callbacks 2022-06-02 17:00:08 +00:00
Alexander Tokmakov
58f8c87265
Merge pull request #36937 from bigo-sg/fix_settings
Fix overrided settings: normalize_function_names
2022-06-02 17:45:17 +03:00
HeenaBansal2009
e3080f2a97 Merge remote-tracking branch 'origin' into Fix-all-CheckTriviallyCopyableMove-Errors 2022-06-02 07:30:08 -07:00
Alexander Tokmakov
cce9057eef fix style check 2022-06-02 15:27:32 +02:00
mergify[bot]
fbfaaa9c74
Merge branch 'master' into fix-mutations-again 2022-06-02 11:57:19 +00:00
Nikolai Kochetov
85f4295370 Cleanup 2022-06-02 10:34:40 +00:00
Nikolai Kochetov
fc726c236f
Merge pull request #37661 from ClickHouse/no_alias_actions
Trying to remove prewhere_info.alias_actions as they seem to always be included in prewhere_actions
2022-06-02 12:31:04 +02:00
Nikolai Kochetov
89c5855d20 Merge branch 'master' into refactor-something-in-part-volumes 2022-06-02 12:19:07 +02:00
Kseniia Sumarokova
b24f34dd93
Merge pull request #37585 from Vxider/fix-temp-table-drop
Flush and shutdown temporary table before drop
2022-06-02 12:07:50 +02:00
Kseniia Sumarokova
9f0ebb4eac
Merge pull request #37754 from Avogar/fix-values-func
Fix possible logical error in values table function
2022-06-02 12:01:24 +02:00
Nikita Mikhaylov
d34e051c69
Support for simultaneous read from local and remote parallel replica (#37204) 2022-06-02 11:46:33 +02:00
Nikolai Kochetov
edac3d6714 Merge branch 'master' into refactor-read-metrics-and-callbacks 2022-06-02 09:36:20 +00:00
Maksim Kita
cb93135326
Merge pull request #37711 from kitaisreal/executable-user-defined-functions-nullable-arguments-fix
Fix executable user default functions execution with Nullable arguments
2022-06-02 11:05:34 +02:00
Nikolay Degterinsky
9575a6d048
Merge pull request #37587 from bigo-sg/typo
Fix a typo
2022-06-02 02:18:03 +02:00
avogar
7ef02a2e44 Fix possible logical error in values table function 2022-06-01 15:32:33 +00:00
Dmitry Novik
7fbe91ca81
Merge pull request #37460 from ClickHouse/memory-overcommit-improvement
Memory Overcommit: update defaults, exception message and add ProfileEvent
2022-06-01 17:06:33 +02:00
Sema Checherinda
16dc3ed97d FR: Expose what triggered the merge in system.part_log #26255 2022-06-01 16:58:07 +02:00
Sema Checherinda
2626a49616 FR: Expose what triggered the merge in system.part_log #26255 2022-06-01 16:58:06 +02:00
Alexander Tokmakov
3d346c766a better code 2022-06-01 16:49:26 +02:00
Alexander Tokmakov
75f49a48e1 Merge branch 'master' into fix_trash 2022-06-01 14:20:46 +02:00
Anton Popov
011131198c Merge remote-tracking branch 'upstream/master' into fix-mutations-again 2022-06-01 12:04:18 +00:00
Robert Schulze
ee302f2d9f
Merge pull request #37643 from amosbird/avoid-useless-context-copy
Avoid useless context copy when building query interpreters
2022-06-01 13:49:56 +02:00
Vladimir C
8c0dba7302
Merge pull request #37650 from amosbird/joinget-fix
Fix joinGet with  join_use_nulls = 1 and Array type
2022-06-01 13:30:29 +02:00
Vladimir C
c466cdebf4
Merge pull request #37530 from vdimir/join_cond_dict_issue_37386 2022-06-01 13:29:01 +02:00
Anton Popov
cae2478b3f Revert "Merge pull request #37355 from ClickHouse/revert-37266-fix-mutations-with-object"
This reverts commit a53cfa9fca, reversing
changes made to 9acb42fcdb.
2022-06-01 10:57:20 +00:00
Alexey Milovidov
31b3350749
Merge pull request #37710 from ClickHouse/fix-grouping-function
Make GROUPING function skip constant folding
2022-06-01 12:00:14 +03:00
Alexey Milovidov
a0020cb55c
Merge pull request #37724 from CurtizJ/fix-ast-optimizations-remote
Fix `optimize_monotonous_functions_in_order_by` in distributed queries
2022-06-01 11:54:45 +03:00
Anton Popov
6cf9405f09 fix optimize_monotonous_functions_in_order_by in distributed queries 2022-06-01 00:50:28 +00:00
Nikolai Kochetov
86fbb74703 Merge branch 'master' into refactor-read-metrics-and-callbacks 2022-05-31 18:07:47 +00:00
vdimir
284c9bc68b
Rollback some changes from appendFromBlock 2022-05-31 17:40:35 +00:00
Maksim Kita
66f43b9ad3 Fix executable user default functions execution with Nullable arguments 2022-05-31 18:46:33 +02:00
Dmitry Novik
b11749ca2c Make GROUPING function skip constant folding 2022-05-31 16:45:29 +00:00
vdimir
e7be677fca
Assert structure match up to locard in appendFromBlock 2022-05-31 16:02:58 +00:00
vdimir
7f4ddb1667
Fix assert for 02244_lowcardinality_hash_join 2022-05-31 16:02:57 +00:00
vdimir
2476c6a988
Fix error on joining with dictionary on some conditions 2022-05-31 16:02:57 +00:00
Vladimir C
2a38fdb796
Merge pull request #37653 from vdimir/cross_join_dup_col_names 2022-05-31 17:50:19 +02:00
Anton Popov
00f87b0f57 replace multiIf to if in case of one condition 2022-05-31 14:45:12 +00:00
Nikolai Kochetov
147a819221 Refactor a little bit more. 2022-05-31 14:43:38 +00:00
Dmitry Novik
b41fe00f31
Merge pull request #37542 from azat/grouping-sets-fix-optimize_aggregation_in_order
Prohibit optimize_aggregation_in_order with GROUPING SETS (fixes LOGICAL_ERROR)
2022-05-31 15:31:45 +02:00
Dmitry Novik
f58623a375
Merge pull request #37593 from azat/union-type-cast-resubmit
Fix converting types for UNION queries (may produce LOGICAL_ERROR)
2022-05-31 15:27:50 +02:00
mergify[bot]
ba49c6bb46
Merge branch 'master' into memory-overcommit-improvement 2022-05-31 13:17:06 +00:00
mergify[bot]
f90dddccba
Merge branch 'master' into fix-temp-table-drop 2022-05-31 09:10:00 +00:00
zhanglistar
53020b096d
Merge branch 'ClickHouse:master' into typo 2022-05-31 11:28:12 +08:00
Nikolai Kochetov
77b07dd0a8
Merge pull request #37163 from ClickHouse/grouping-function
Add GROUPING function
2022-05-30 20:45:04 +02:00
Nikolai Kochetov
913e7a91ae Fix limits from subquery. 2022-05-30 18:25:17 +00:00
HeenaBansal2009
b7eb6bbd38 Fixed clang-tidy-CheckTriviallyCopyableMove-errors 2022-05-30 11:09:03 -07:00
Alexander Gololobov
e2dd6f6249 Removed prewhere_info.alias_actions 2022-05-30 19:58:23 +02:00
vdimir
8a3f4bda62
Fix columns number mismatch in cross join 2022-05-30 15:40:15 +00:00
Amos Bird
b68e8efaf0
Fix joinGet with cannot be null type 2022-05-30 21:01:27 +08:00
Nikolai Kochetov
5b4658aa5e Merge branch 'master' into refactor-read-metrics-and-callbacks 2022-05-30 09:47:35 +00:00
Amos Bird
6525bfc4cd
Avoid context copy for InterpreterSelects 2022-05-30 17:08:12 +08:00
Azat Khuzhin
78bd47d8df Fix excessive LIST requests to coordinator for transactions
In [1] there was only few transactions, but lots of List for /test/clickhouse/txn/log:

    $ clickhouse-local --format TSVWithNamesAndTypes --file zookeeper_log.tsv.gz -q "select * except('path|session_id|event_time|thread_id|event_date|xid') apply(x->groupUniqArray(x)), path, session_id, min(event_time), max(event_time), count() from table where has_watch and type = 'Request' group by path, session_id order by count() desc limit 1 format Vertical"
    Row 1:
    ──────
    groupUniqArray(type):             ['Request']
    groupUniqArray(query_id):         ['','62d75128-9031-48a5-87ba-aec3f0b591c6']
    groupUniqArray(address):          ['::1']
    groupUniqArray(port):             [9181]
    groupUniqArray(has_watch):        [1]
    groupUniqArray(op_num):           ['List']
    groupUniqArray(data):             ['']
    groupUniqArray(is_ephemeral):     [0]
    groupUniqArray(is_sequential):    [0]
    groupUniqArray(version):          []
    groupUniqArray(requests_size):    [0]
    groupUniqArray(request_idx):      [0]
    groupUniqArray(error):            []
    groupUniqArray(watch_type):       []
    groupUniqArray(watch_state):      []
    groupUniqArray(stat_version):     [0]
    groupUniqArray(stat_cversion):    [0]
    groupUniqArray(stat_dataLength):  [0]
    groupUniqArray(stat_numChildren): [0]
    groupUniqArray(children):         [[]]
    path:                             /test/clickhouse/txn/log
    session_id:                       1
    min(event_time):                  2022-05-27 12:54:09.025897
    max(event_time):                  2022-05-27 13:37:12.846314 <!-- last transaction was at 12:54, see server log
    count():                          3673675 <-- huge

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/37593/2613149f6bf4f242bbbf2c3c8539b5176fd77286/stateless_tests__debug__actions__[1/3].html

Server log:

    $ pigz -cd clickhouse-server.log.gz | fgrep TransactionLog: | head -1
    2022.05.27 12:54:09.026852 [ 5018 ] {62d75128-9031-48a5-87ba-aec3f0b591c6} <Trace> TransactionLog: Loading 33 entries from /test/clickhouse/txn/log: csn-0000000000..csn-0000000032
    $ pigz -cd clickhouse-server.log.gz | fgrep TransactionLog: | tail -1
    2022.05.27 12:54:58.909222 [ 509 ] {} <Test> TransactionLog: Closing readonly transaction (177, 38, 41b51ff1-bcba-43bf-bcea-e97ad05f6040)
    $ pigz -cd clickhouse-server.log.gz | fgrep 62d75128-9031-48a5-87ba-aec3f0b591c6 | tail -1
    2022.05.27 12:54:09.064857 [ 5018 ] {62d75128-9031-48a5-87ba-aec3f0b591c6} <Debug> MemoryTracker: Peak memory usage (for query): 0.00 B.

Fixes: #37398 (cc @tavplubix)
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-30 11:39:34 +03:00
taiyang-li
0b0d38b18c Merge branch 'master' into fix_settings 2022-05-30 10:07:09 +08:00
Alexey Milovidov
73e2e63414
Merge pull request #37612 from ClickHouse/clang-tidy-14
Fix clang-tidy-14, part 1
2022-05-29 03:16:32 +03:00
Alexander Tokmakov
4e52f45695 Merge branch 'master' into fix_trash 2022-05-28 19:43:19 +02:00
Anton Popov
1d9b3be7da
Merge pull request #37536 from CurtizJ/profile-events-for-part-types
Add profile events for introspection of part types
2022-05-28 14:25:21 +02:00
Alexey Milovidov
c50791dd3b Fix clang-tidy-14, part 1 2022-05-27 22:52:14 +02:00
Nikolai Kochetov
b80b1940ce Fix some tests. 2022-05-27 20:47:35 +00:00
Alexander Tokmakov
7e659036f8 fix 2022-05-27 20:30:06 +02:00
Dmitry Novik
60b9d81773 Remove global_memory_usage_overcommit_max_wait_microseconds 2022-05-27 16:30:29 +00:00
Azat Khuzhin
8a224239c1 Prohibit optimize_aggregation_in_order with GROUPING SETS
AggregatingStep ignores it anyway, and it leads to the following error
in getSortDescriptionFromGroupBy(), like in [1]:

    2022.05.24 04:29:29.279431 [ 3395 ] {26543564-8bc8-4a3a-b984-70a2adf0245d} <Fatal> : Logical error: 'Trying to get name of not a column: ExpressionList'.

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/36914/67d3ac72d26ab74d69f03c03422349d4faae9e19/stateless_tests__ubsan__actions_.html

v2: revert change to getSortDescriptionFromGroupBy() after
    GroupingSetsRewriterVisitor had been introduced
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-27 17:44:57 +03:00
Azat Khuzhin
1f29b0a901 Rewrite queries GROUPING SETS (foo, bar) to GROUP BY foo, bar
This is better then introducing separate
SelectQueryExpressionAnalyzer::useGroupingSetKey(), since for
optimize_aggregation_in_order that method will not be enough, because
size of ManyExpressionActions will not match size of SortDescription, in
ReadInOrderOptimizer::ReadInOrderOptimizer()

And plus it is cleaner.

v2: fix clang-tidy
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-27 17:44:51 +03:00
alesapin
6d6779f17a
Merge pull request #37139 from ClickHouse/i_object_storage
Separate object storage operations from disks
2022-05-27 13:59:50 +02:00
Azat Khuzhin
2613149f6b Fix converting types for UNION queries (may produce LOGICAL_ERROR)
CI founds [1]:

    2022.02.20 15:14:23.969247 [ 492 ] {} <Fatal> BaseDaemon: (version 22.3.1.1, build id: 6082C357CFA6FF99) (from thread 472) (query_id: a5187ff9-962a-4e7c-86f6-8d48850a47d6) (query: SELECT 0., round(avgWeighted(x, y)) FROM (SELECT toDate(toDate('214748364.8', '-922337203.6854775808', '-0.1', NULL) - NULL, 10.000100135803223, '-2147483647'), 255 AS x, -2147483647 AS y UNION ALL SELECT y, NULL AS x, 2147483646 AS y)) Received signal Aborted (6)

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/0/26d0e5438c86e52a145aaaf4cb523c399989a878/fuzzer_astfuzzerdebug,actions//report.html

The problem is that subqueries returns different headers:
- first query  -- x, y
- second query -- y, x

v2: Make order of columns strict only for UNION
    https://s3.amazonaws.com/clickhouse-test-reports/34775/9cc8c01a463d18c471853568b2f0af659a4e643f/stateless_tests__address__actions__[2/2].html
    Fixes: 00597_push_down_predicate_long
v3: add no-backward-compatibility-check for the test
Fixes: #37569
Resubmit: #34775
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
(cherry picked from commit a813f5996e)
2022-05-27 14:11:57 +03:00
zhanglistar
ca67e67a74 Fix a typo 2022-05-27 15:52:04 +08:00
Vxider
54d6f98122 flush and shutdown temporary table before drop 2022-05-27 04:50:36 +00:00
Dmitry Novik
3a9239b79f
Revert "RFC: Fix converting types for UNION queries (may produce LOGICAL_ERROR)" 2022-05-27 04:05:32 +02:00
Alexander Tokmakov
eb71dd4c78
Merge pull request #37547 from ClickHouse/followup_37398
Follow-up to #37398
2022-05-26 20:29:41 +03:00
Dmitry Novik
673a521d0b
Merge pull request #34775 from azat/union-type-cast
RFC: Fix converting types for UNION queries (may produce LOGICAL_ERROR)
2022-05-26 17:28:23 +02:00
Alexander Tokmakov
e8f33fb0d9 fix flaky tests 2022-05-26 14:17:05 +02:00
Nikolai Kochetov
bf95541531 Fixing style. 2022-05-26 11:09:36 +00:00
Nikolai Kochetov
84f97b53de Merge branch 'master' into refactor-read-metrics-and-callbacks 2022-05-26 11:07:45 +00:00
Nikolai Kochetov
fea2401f1f
Merge pull request #37532 from ClickHouse/add-separate-mutex-for-factories-info
Use a separate mutex for query_factories_info in Context.
2022-05-26 13:03:28 +02:00
Dmitry Novik
16c6b60703 Introduce AggregationKeysInfo 2022-05-25 23:22:29 +00:00
Alexander Tokmakov
3d259fa0de
Update Context.cpp 2022-05-25 23:18:07 +03:00
alesapin
6f5c86e55e Merge branch 'master' into i_object_storage 2022-05-25 20:49:01 +02:00
Alexander Tokmakov
779e6ea0b9 make it better, fix on cluster queries 2022-05-25 20:17:49 +02:00
Azat Khuzhin
a813f5996e Fix converting types for UNION queries (may produce LOGICAL_ERROR)
CI founds [1]:

    2022.02.20 15:14:23.969247 [ 492 ] {} <Fatal> BaseDaemon: (version 22.3.1.1, build id: 6082C357CFA6FF99) (from thread 472) (query_id: a5187ff9-962a-4e7c-86f6-8d48850a47d6) (query: SELECT 0., round(avgWeighted(x, y)) FROM (SELECT toDate(toDate('214748364.8', '-922337203.6854775808', '-0.1', NULL) - NULL, 10.000100135803223, '-2147483647'), 255 AS x, -2147483647 AS y UNION ALL SELECT y, NULL AS x, 2147483646 AS y)) Received signal Aborted (6)

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/0/26d0e5438c86e52a145aaaf4cb523c399989a878/fuzzer_astfuzzerdebug,actions//report.html

The problem is that subqueries returns different headers:
- first query  -- x, y
- second query -- y, x

v2: Make order of columns strict only for UNION
    https://s3.amazonaws.com/clickhouse-test-reports/34775/9cc8c01a463d18c471853568b2f0af659a4e643f/stateless_tests__address__actions__[2/2].html
    Fixes: 00597_push_down_predicate_long
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-25 20:31:47 +03:00
Nikolai Kochetov
1f9b1cf726 Fixing build. 2022-05-25 18:59:46 +02:00
Nikolai Kochetov
7b681fa8ac Fixing build. 2022-05-25 17:15:23 +02:00
Anton Popov
16e839ac71 add profile events for introspection of part types 2022-05-25 14:54:49 +00:00
Nikolai Kochetov
1b85f2c1d6 Merge branch 'master' into refactor-read-metrics-and-callbacks 2022-05-25 16:27:40 +02:00
Nikolai Kochetov
6370c29049 Use a separate mutex for query_factories_info in Context. 2022-05-25 14:16:59 +00:00
mergify[bot]
f49552d48e
Merge branch 'master' into grouping-sets-optimization-fix 2022-05-25 13:03:54 +00:00
Nikolai Kochetov
3d84aae0ab Better. 2022-05-24 20:06:08 +00:00
Igor Nikonov
04e2737a57
Merge pull request #37337 from ClickHouse/column_decl_null_before_default_value
Column declaration: [NOT] NULL right after type 

+ fixed: data_type_default_nullable=true, it didn't make columns nullable
         if the column declaration contains default expression w/o type

Issue #37229
2022-05-24 21:16:25 +02:00
Dmitry Novik
c4dc0f7cda Fix ORDER BY optimization in case of GROUPING SETS 2022-05-24 18:56:22 +00:00
Alexander Tokmakov
4618429201 fixes 2022-05-24 18:53:52 +02:00
Vitaly Baranov
497c70d786
Merge pull request #37269 from vitlibar/rework-access-control-notifications
Rework AccessControl's notifications.
2022-05-24 17:47:45 +02:00
Alexander Tokmakov
bb5f04efaf Merge branch 'master' into fix_trash 2022-05-24 17:45:51 +02:00
Vladimir C
0eaf22b370
Merge pull request #37453 from vdimir/join_auto_lc_nullable_bug 2022-05-24 16:28:23 +02:00
Vladimir C
bec4ae87c9
Merge pull request #37472 from amosbird/joinpushdown 2022-05-24 16:08:26 +02:00
Alexander Tokmakov
229d35408b
Merge pull request #37398 from ClickHouse/fixes_for_transactions
Fixes for transactions
2022-05-24 15:28:01 +03:00
Alexander Tokmakov
dbde63d275 fixes 2022-05-24 14:24:03 +02:00
Amos Bird
76ddb39d02
refactor format 2022-05-24 12:09:00 +08:00
taiyang-li
c7e68d664d fix building 2022-05-24 10:58:45 +08:00
Igor Nikonov
838a6c6f61 Column declaration: [NOT] NULL right after type
+ fixed: data_type_default_nullable=true, it didn't make columns nullable
         if the column declaration contains default expression w/o type

Issue #37229
2022-05-23 22:03:45 +00:00
mergify[bot]
51ff49a0ee
Merge branch 'master' into i_object_storage 2022-05-23 20:29:49 +00:00
Alexander Tokmakov
3f44f34fe1 review suggestions 2022-05-23 21:55:17 +02:00
Nikolai Kochetov
fd97a9d885 Move some resources 2022-05-23 19:47:32 +00:00
Alexander Tokmakov
d0f998fb88 Merge branch 'master' into fix_trash 2022-05-23 21:25:56 +02:00
Alexander Tokmakov
fa21121f77 fix 2022-05-23 21:17:52 +02:00
Alexander Tokmakov
a262492cc1 slightly better 2022-05-23 20:53:33 +02:00
Alexander Tokmakov
6bc68c0cbc Merge branch 'master' into fixes_for_transactions 2022-05-23 18:49:21 +02:00
Vladimir C
14a820c2a9
Merge pull request #37336 from vdimir/fix_clash_const_aggegate_join 2022-05-23 17:09:30 +02:00
Nikolai Kochetov
9756b759c6 Move some resources 2022-05-23 13:46:57 +00:00
vdimir
dabb150a95
Fix cast lowcard of nullable in JoinSwitcher 2022-05-23 13:05:59 +00:00
Antonio Andelic
87d445295f
Merge pull request #37342 from azat/projections-optimize_aggregation_in_order-fix
Fix projections with GROUP/ORDER BY in query and optimize_aggregation_in_order
2022-05-23 12:29:16 +02:00
taiyang-li
c120b19802 fix building 2022-05-23 17:42:20 +08:00
taiyang-li
f13dcad58c Merge branch 'master' into fix_settings 2022-05-23 17:36:45 +08:00
mergify[bot]
747aa5575c
Merge branch 'master' into remove-useless-code-2 2022-05-22 17:41:57 +00:00
alesapin
06c3dd69c0 Move directories 2022-05-22 13:51:48 +02:00
alesapin
c8d92b87c8 Merge branch 'master' into i_object_storage 2022-05-22 12:16:10 +02:00
Robert Schulze
19d53c14fa
Merge pull request #37382 from ClickHouse/wc++98-compat-extra-semi
Enable -Wc++98-compat-extra-semi
2022-05-22 09:40:45 +02:00
Alexey Milovidov
6322d064b8
Merge pull request #37384 from Avogar/short-circuit-process
Try to improve short circuit functions processing
2022-05-21 23:43:56 +03:00
Alexey Milovidov
d1678c9662
Update ExpressionActions.cpp 2022-05-21 23:43:26 +03:00
Vitaly Baranov
58f4a86ec7 Rework notifications used in access management. 2022-05-21 10:15:39 +02:00
Alexander Tokmakov
1b453f517d fix 2022-05-21 02:32:35 +02:00
Alexander Tokmakov
c48410b574 fix trash in my code 2022-05-21 02:05:02 +02:00
Alexander Tokmakov
44f2d4529a better waiting, add fault injection 2022-05-20 22:10:01 +02:00
Nikolai Kochetov
56feef01e7 Move some resources 2022-05-20 19:49:31 +00:00
Alexey Milovidov
c77b078c2c
Merge pull request #37367 from ClickHouse/grouping-sets-with-rollup-cube
Disable WITH ROLLUP/CUBE for GROUPING SETS
2022-05-20 22:34:56 +03:00
Alexander Tokmakov
1027798517 handle connection loss on commit 2022-05-20 17:35:29 +02:00
Robert Schulze
0f6715bd91
Follow-up to PR #37300: semicolon warnings
In PR #37300, Alexej asked why we the compiler does not warn about
unnecessary semicolons, e.g.

  f()
  {
  }; // <-- here

The answer is surprising: In C++98, above syntax was disallowed but by
most compilers accepted it regardless. C++>11 introduced "empty
declarations" which made the syntax legal.

The previous behavior can be restored using flag
-Wc++98-compat-extra-semi. This finds many useless semicolons which were
removed in this change. Unfortunately, there are also false positives
which would require #pragma-s and HAS_* logic (--> check_flags.cmake) to
suppress. In the end, -Wc++98-compat-extra-semi comes with extra effort
for little benefit. Therefore, this change only fixes some semicolons
but does not enable the flag.
2022-05-20 15:06:34 +02:00
avogar
22b072bc7f Make better 2022-05-20 13:04:43 +00:00
avogar
3884819bd1 Fix 2022-05-20 12:48:58 +00:00
vdimir
339980469f
Revert "Swap order of converting_join_columns and before_join steps"
This reverts commit 2995b69f4a.
2022-05-20 11:31:59 +00:00
vdimir
23a85d3406
Perserve constness in ExpressionActionsChain::JoinStep 2022-05-20 11:31:58 +00:00
avogar
5d19150906 Try to improve short circuit functions processing 2022-05-20 10:47:28 +00:00
Alexander Tokmakov
12bbb7de87 fix race on TID allocation 2022-05-20 12:41:44 +02:00
alesapin
654b27e307 Merge branch 'master' into i_object_storage 2022-05-20 11:56:13 +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
alesapin
92c15ec97c Get rid of IDiskRemote 2022-05-19 20:07:15 +02:00
Dmitry Novik
b3ccf96c81 Merge remote-tracking branch 'origin/master' into grouping-function 2022-05-19 17:58:33 +00:00
Dmitry Novik
d4c66f4a48 Code cleanup & fix GROUPING() with TOTALS 2022-05-19 16:36:51 +00:00
Dmitry Novik
86d48e1c99 Disable WITH ROLLUP/CUBE for GROUPING SETS 2022-05-19 14:10:04 +00:00
Alexander Tokmakov
a53cfa9fca
Merge pull request #37355 from ClickHouse/revert-37266-fix-mutations-with-object
Revert "Fix mutations in tables with columns of type `Object`"
2022-05-19 16:27:22 +03:00
Kseniia Sumarokova
24d0899cb7
Merge pull request #36945 from Vxider/wv-populate
POPULATE support for WindowView
2022-05-19 13:47:52 +02:00
Kseniia Sumarokova
791cc5ced1
Merge pull request #37290 from azat/query-kind-client
Add ability to pass QueryKind via clickhouse-client/local (useful for debugging)
2022-05-19 13:22:42 +02:00
Alexander Tokmakov
f787dc7097
Revert "Fix mutations in tables with columns of type Object" 2022-05-19 13:24:48 +03:00
Azat Khuzhin
e32b695775 Fix projections with GROUP/ORDER BY in query and optimize_aggregation_in_order
With projections, GROUP BY/ORDER BY in query, optimize_aggregation_in_order,
GROUP BY's InputOrderInfo was used incorrectly for ORDER BY.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-19 13:11:22 +03:00
Vitaly Baranov
16c8e93dd0
Merge pull request #36941 from nvartolomei/nv/show-grants-current-roles
Allow a user to inspect grants from granted roles
2022-05-19 09:20:52 +02:00
Azat Khuzhin
54a6aaef62 Log query processing stage in executeQuery()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-19 07:19:26 +03:00
Azat Khuzhin
dea1706d4e
Fix GROUP BY AggregateFunction (#37093)
* Fix GROUP BY AggregateFunction

finalizeChunk() was unconditionally converting AggregateFunction to the
underlying type, however this should be done only if the aggregate was
applied.

So pass names of aggregates as an argument to the finalizeChunk()

Fuzzer report [1]:

    Logical error: 'Bad cast from type DB::ColumnArray to DB::ColumnAggregateFunction'. Received signal 6 Received signal Aborted (6)

For the following query:

    SELECT
        arraySort(groupArrayArray(grp_simple)),
        grp_aggreg,
        arraySort(groupArrayArray(grp_simple)),
        b,
        arraySort(groupArrayArray(grp_simple)) AS grs
    FROM data_02294
    GROUP BY
        a,
        grp_aggreg,
        b
    SETTINGS optimize_aggregation_in_order = 1

  [1]: https://s3.amazonaws.com/clickhouse-test-reports/37050/323ae98202d80fc4b311be1e7308ef2ac39e6063/fuzzer_astfuzzerdebug,actions//fuzzer.log

v2: fix conflicts in src/Interpreters/InterpreterSelectQuery.cpp
v3: Fix header for GROUP BY AggregateFunction WITH TOTALS
v4: Add sanity check into finalizeBlock()
v5: Use typeid_cast<&> to get more sensible error in case of bad cast (as suggested by @nickitat)
v6: Fix positions passed to finalizeChunk()
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>

* Core/ColumnNumbers.h: remove unused <string>

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>

* Optimize finalizeChunk()/finalizeBlock()

v2: s/ByPosition/Mask/ s/by_position/mask/
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-18 23:37:43 +02:00
Alexander Tokmakov
3bc39f9929 fixes 2022-05-18 21:57:20 +02:00
vdimir
2995b69f4a
Swap order of converting_join_columns and before_join steps 2022-05-18 19:31:14 +00:00
Vitaly Baranov
9ccddc44c6
Merge pull request #35767 from azat/ON_CLUSTER-grant
RFC: Add separate CLUSTER grant
2022-05-18 19:19:54 +02:00
Alexander Tokmakov
9772924d06 Merge branch 'master' into fix_trash 2022-05-18 17:27:54 +02:00
Dmitry Novik
6356112a76 Refactor GROUPING function 2022-05-18 15:23:31 +00:00
Alexander Tokmakov
19afeda4b1 fix style 2022-05-18 14:23:52 +02:00
Alexander Tokmakov
538b5cd536 fix more trash 2022-05-18 14:06:52 +02:00
Vladimir C
7d88b81622
Merge pull request #37193 from azat/fix-limit-by-in-dist-queries
Fix "Cannot create column of type Set" for distributed queries with LIMIT BY
2022-05-18 13:28:19 +02:00
Anton Popov
4def736ecb
Merge pull request #37275 from ernado/fix/open-telemetry-span-log-fix-alias
Fix attribute.values alias for OTEL table
2022-05-18 13:18:07 +02:00
Nicolae Vartolomei
32b9959dec Allow a user to inspect grants from granted roles 2022-05-18 10:44:18 +00:00
Vladimir C
1779fb08ed
Merge pull request #36271 from yuuch/support_collation_in_create_query 2022-05-18 12:43:49 +02:00
Vladimir C
f979a03fbe
Merge pull request #37256 from vdimir/issue_37217 2022-05-18 12:42:47 +02:00
alesapin
e99c90118e Merge branch 'master' into i_object_storage 2022-05-18 12:36:22 +02:00
Kruglov Pavel
aaace46da2
Merge pull request #37266 from CurtizJ/fix-mutations-with-object
Fix mutations in tables with columns of type `Object`
2022-05-18 12:19:55 +02:00
Dmitry Novik
a82239984c Remove include 2022-05-18 01:44:51 +00:00
Alexander Tokmakov
5590adeffa fix more trash 2022-05-17 23:04:24 +02:00
Dmitry Novik
a97ba9741e Fix possible deadlock in OvercommitTracker during logging 2022-05-17 18:07:52 +00:00
Alexander Tokmakov
dea39d8175 fix some trash 2022-05-17 18:22:52 +02:00
Vitaly Baranov
f34a5cdee2
Merge branch 'master' into ON_CLUSTER-grant 2022-05-17 13:21:20 +02:00
taiyang-li
8228bbc36f disable normarlize functions when query is secondary 2022-05-17 16:22:31 +08:00
taiyang-li
9f3dadf17c Merge branch 'master' into fix_settings 2022-05-17 16:19:29 +08:00
Vxider
f74c934a61 Merged with master 2022-05-17 02:53:59 +00:00
Aleksandr Razumov
60693afb56
Fix attribute.values alias for OTEL table 2022-05-17 01:28:36 +03:00
Robert Schulze
43945cea1b
Fixing some warnings 2022-05-16 20:59:27 +02:00
Anton Popov
b6c5ab4fcf fix mutations in tables with columns of type Object 2022-05-16 18:26:53 +00:00
Dmitry Novik
e5b395e054 Support ROLLUP and CUBE in GROUPING function 2022-05-16 17:33:38 +00:00
Alexander Tokmakov
712a04d69c Revert "Removed an unnecessary check and extra logging"
This reverts commit 59ed1f9d8e.
2022-05-16 18:56:00 +02:00
alesapin
ce6d5f7dcc Merge branch 'master' into i_object_storage 2022-05-16 17:42:22 +02:00
Dmitry Novik
dd1e7b55b8
Merge pull request #37050 from azat/fix-optimize_aggregation_in_order-prefix-Array
Fix optimize_aggregation_in_order with prefix GROUP BY and *Array aggregate functions
2022-05-16 17:17:56 +02:00
vdimir
76852ae49c
Pass need_filter, has_null_map to joinRightColumns 2022-05-16 14:27:27 +00:00
Robert Schulze
ed7df7cabd
Merge pull request #36960 from ClickHouse/clangtidies
Enable clangtidies
2022-05-16 14:22:50 +02:00
alesapin
1829256ae2
Merge pull request #37178 from ClickHouse/ignore_auto_increment_in_create_table_2
Ignore AUTO_INCREMENT in CREATE TABLE to simplify migration from MySQL
2022-05-16 13:29:22 +02:00
Azat Khuzhin
01e1c5345a Add separate CLUSTER grant
In case you have different roles for the same user on multiple clusters,
ON CLUSTER query can help to overcome some limitations.

Consider the following example:
- cluster_with_data, dev_user (readonly=2)
- stage_cluster, dev_user (readonly=0)

So when you will execute the following query from stage_cluster, it will
be successfully executed, since ON CLUSTER queries has different system
profile:

    DROP DATABASE default ON CLUSTER cluster_with_data

This is not 100% safe, but at least something.

Note, that right now only ON CLUSTER query it self is supported, but
separate clusters are not (i.e. GRANT CLUSTER some_cluster_name TO
default), since right now grants sticked to database+.

v2: on_cluster_queries_require_cluster_grant
v3: fix test and process flags as bit mask
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-16 13:57:45 +03:00
alesapin
b10f26e3ed Fix style 2022-05-16 12:25:25 +02:00
Vladimir C
75008d5903
Merge pull request #37166 from vdimir/issue_37141 2022-05-16 12:21:41 +02:00
Robert Schulze
d66dcdad79
Fix new occurrences of new clang-tidy warnings 2022-05-16 11:31:36 +02:00
Robert Schulze
e3cfec5b09
Merge remote-tracking branch 'origin/master' into clangtidies 2022-05-16 10:12:50 +02:00
Vasily Nemkov
59ed1f9d8e Removed an unnecessary check and extra logging 2022-05-16 09:29:54 +03:00
Alexey Milovidov
8334329dff
Merge pull request #37023 from ClickHouse/chained-or
Merging #34932.
2022-05-15 04:32:31 +03:00
Vxider
f2ef27e5d6 rename windowview header 2022-05-14 09:21:54 +00:00
Dmitry Novik
6fc7dfea80 Support ordinary GROUP BY 2022-05-13 23:04:12 +00:00
alesapin
cc304a3178 Merge branch 'master' into i_object_storage 2022-05-13 23:44:00 +02:00
Nikolai Kochetov
0a715b26db Move some resources. 2022-05-13 20:02:28 +00:00
Dmitry Novik
efb30bdf64 Correctly use __grouping_set_map column 2022-05-13 18:20:12 +00:00
Azat Khuzhin
b29a0f3c84 Fix "Cannot create column of type Set" for distributed queries with LIMIT BY
The problem was that after #36454 it requires too much columns.

Fixes: #36454
Fixes: #37045
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-13 20:03:19 +03:00
Azat Khuzhin
751a85521e Fill possible WITH FILL error in SelectQueryExpressionAnalyzer::appendOrderBy()
If order_by_keys was filled by the code above then WITH FILL will
incorrectly handle constant columns.

Fixes: #16618
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-05-13 20:03:19 +03:00
alesapin
eba60ff38f Fix restorable schema 2022-05-13 17:00:47 +02:00
Dmitry Novik
ae81268d4d Try to compute helper column lazy 2022-05-13 14:55:50 +00:00
Igor Nikonov
74be0946ff Test fixes 2022-05-13 13:33:45 +00:00
Vasily Nemkov
fdd42f19ff Less obscure message on destroying Session 2022-05-13 15:27:59 +03:00
Igor Nikonov
8d5cabc8f7 Fix style warnings and review comments 2022-05-13 11:27:17 +00:00
vdimir
976a274f91
Add comment for visiting children of select in ApplyWithGlobalVisitor 2022-05-13 10:53:26 +00:00
Vasily Nemkov
2e669f69f4 Added checks to validate that authentication happens before creating query or session context;
Updated logging of user_id, removed unnecessary precautions
Explicitly stating in Session d-tor if user was not authenticated
2022-05-13 13:46:24 +03:00
vdimir
dc2a90a344
ApplyWithGlobalVisitor for WITH in subquery 2022-05-13 10:40:51 +00:00
Kseniia Sumarokova
6d5137879b
Merge pull request #37054 from kssenii/better-read-from-cache
Better read from cache buffer
2022-05-13 12:20:06 +02:00