Commit Graph

27989 Commits

Author SHA1 Message Date
Maksim Kita
3a1d8f4518
Merge pull request #38565 from ClickHouse/merging-column-vector-replicate-optimize
Merging #37235
2022-06-30 18:29:51 +02:00
Maksim Kita
4e55550490
Merge pull request #38602 from kitaisreal/cache-dictionary-simplify-update-queue
CacheDictionary simplify update queue
2022-06-30 18:26:26 +02:00
Alexander Tokmakov
d2cbdc7c53
Update ReplicatedMergeTreeQueue.cpp 2022-06-30 17:23:53 +03:00
Maksim Kita
a0e5768956
Merge pull request #38623 from loyispa/patch
Fix typo
2022-06-30 16:02:36 +02:00
Maksim Kita
d31ca4c4b6 Fixed tests 2022-06-30 14:49:11 +02:00
Anton Popov
7c721578c7
Merge pull request #38320 from CurtizJ/dynamic-columns-16
Improve performace of insertion to columns of type JSON
2022-06-30 14:18:20 +02:00
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
Maksim Kita
95687f2d01 CacheDictionaryUpdateUnit make update state non atomic 2022-06-30 13:15:35 +02:00
Maksim Kita
0de66a2712
Merge pull request #38449 from ClickHouse/revert-38361-revert-38324-fix-partial-sort
Revert "Revert "Fix optimization in PartialSortingTransform (SIGSEGV and possible incorrect result)""
2022-06-30 13:02:38 +02:00
Azat Khuzhin
a47355877e
Add revision() function (#38555)
It can be useful to match versions, since in some tables
(system.trace_log) there is only revision column.

P.S. came to this when was digging into stress reports from CI.
P.P.S. case insensitive by analogy with version().

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-30 12:58:26 +02:00
Maksim Kita
f443cf66f0 CacheDictionary simplify update queue 2022-06-30 12:53:56 +02:00
Maksim Kita
83375465eb
Merge pull request #38601 from kitaisreal/dictionaries-added-tsa-annotations
Dictionaries added TSA annotations
2022-06-30 12:51:54 +02:00
loyispa
109c9bcbd5 Fix typo 2022-06-30 18:37:19 +08: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
Antonio Andelic
de264117fd
Merge pull request #38118 from bigo-sg/storagehive_struct_type
Add struct type support in `StorageHive`
2022-06-30 09:11:13 +02:00
Igor Nikonov
bd4a208428
Merge pull request #38438 from ClickHouse/distinct_sorted_small_refact
Distinct sorted: calculate column positions once
2022-06-30 00:53:17 +02: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
Maksim Kita
09be594c81 Dictionaries added TSA annotations 2022-06-29 19:15:47 +02:00
alesapin
62e7a89f26 Proper fix for ipv4/ipv6 conversion error 2022-06-29 17:53:08 +02:00
Maksim Kita
65110fdffc ColumnVector refactor replicate SSE42 optimization 2022-06-29 17:50:25 +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
ea0996674f
Merge pull request #37235 from zzachimed/column_replicate_optimize_v2
Improve performance for column replicate for uint32 type. In our benc…
2022-06-29 13:45:22 +02:00
Alexander Tokmakov
8246e55002
Merge pull request #38486 from azat/fix-parts-removal
Fix parts removal after incorrect server shutdown
2022-06-29 14:17:59 +03:00
Alexander Tokmakov
32c6a944ee
Merge pull request #38541 from Algunenano/rmarin_fix_replicated_create_table_compat
Fix table creation to avoid replication issues with pre-22.4 replicas
2022-06-29 14:15:50 +03:00
Maksim Kita
eeae73e0cf SQL create drop index update implementation 2022-06-29 13:10:30 +02:00
Kruglov Pavel
b9813bcdea
Merge pull request #38356 from kssenii/fix-rabbitmq-with-peekable
Fix RabbitMQ with formats based on PeekableReadBuffer
2022-06-29 13:06:10 +02: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
mergify[bot]
26258959b1
Merge branch 'master' into distinct_sorted_small_refact 2022-06-29 09:38:34 +00: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
0d27672ac8
Merge pull request #38440 from xiedeyantu/allow_trailing_comma
Allow trailing comma in columns list
2022-06-29 09:47:09 +03:00
Alexey Milovidov
e7dbe526f8
Update ParserCreateQuery.cpp 2022-06-29 09:46:45 +03: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
d75af09f74 Fix style error 2022-06-29 11:08:05 +08: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
9154aec201 Fix compile error 2022-06-29 11:08:05 +08:00
Jianmei Zhang
13231d6a85 Pass command type for create and drop index 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
Igor Nikonov
c1840e798c Fix: wrong header variable was used 2022-06-28 20:15:16 +00:00
Igor Nikonov
d80a21a445 Distinct sorted: calculate column positions once in constructor
- instead of calculating them on every chunk
2022-06-28 19:59:05 +00: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
Raúl Marín
9b4da86e2e Adapt table creation with replication to avoid issues with pre-22.4 replicas 2022-06-28 20:12:07 +02:00
Alexander Tokmakov
4f54abf67f better names for macros 2022-06-28 16:27:18 +02:00