Commit Graph

92266 Commits

Author SHA1 Message Date
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
4a52d3f6b9 tests: update reference for 00597_push_down_predicate_long
CI: https://s3.amazonaws.com/clickhouse-test-reports/37887/6b4613c88056f3901f6d8a832c9e2bc15e22206d/stateless_tests__aarch64__actions_.html
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-28 22:53:03 +03: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
563fac5333 tests: add a test for incorrect header in UNION queries
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
75f7662ebb
Rename slightly weirdly named "BuilderBinTidy" to "BuilderClangTidy" 2022-06-28 19:47:00 +00:00
Azat Khuzhin
1648cd0eb0 tests: cleanup tmp data in 02335_column_ttl_expired_column_optimization
v2: remove trap usage as requested by @tavplubix
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-28 22:43:09 +03:00
mergify[bot]
a1d7b1dbf3
Merge branch 'master' into master 2022-06-28 19:36:07 +00:00
Julian Gilyadov
d0d72e0b5e
Implement L2Squared Distance and Norm 2022-06-28 15:28:58 -04: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
mergify[bot]
3f266954f0
Merge branch 'master' into deprecate_ordinary_database 2022-06-28 18:13:36 +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
0bb036dd21
Update Dockerfile 2022-06-28 20:35:20 +03:00
Maksim Kita
2b11c0daa9 Updated tests 2022-06-28 19:26:15 +02:00
Yakov Olkhovskiy
e78db73078 update poco 2022-06-28 12:56:43 -04:00
Robert Schulze
30f136867f
Fix build 2022-06-28 16:52:17 +00:00
Yakov Olkhovskiy
52d6b45a09 update poco 2022-06-28 12:37:07 -04:00
Ilya Yatsishin
400c8ad7a4
Merge pull request #38505 from jrdi/patch-1
Specify that write quorum can be activated
2022-06-28 18:11:09 +02:00
Mikhail f. Shiryaev
e1ac7477c9
Avoid killing terminate-instances task 2022-06-28 17:51:47 +02:00
mergify[bot]
4a1fefb42d
Merge branch 'master' into deprecate_ordinary_database 2022-06-28 15:49:52 +00:00
Alexander Tokmakov
66cf6da35c
Merge pull request #38518 from ClickHouse/tavplubix-patch-1
Fix `_csv.Error: field larger than field limit`
2022-06-28 18:46:43 +03:00
GruffGemini
9fc7c9f575
Update group-by.md
docs (group-by.md): fixed broken links
2022-06-28 17:55:16 +03:00
Alexander Tokmakov
e23f1fa774
Merge pull request #38269 from excitoon-favorites/integrationtestsfixes
Don't try to kill empty list of containers in `integration/runner` II
2022-06-28 17:35:48 +03:00
Alexander Tokmakov
4f54abf67f better names for macros 2022-06-28 16:27:18 +02:00
Anton Popov
58c8facebb minor fixes 2022-06-28 14:21:21 +00:00
mergify[bot]
bed1f68c74
Merge branch 'master' into sql-insert-format 2022-06-28 14:20:31 +00: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
alesapin
6429b72371 Fixes 2022-06-28 14:41:22 +02:00
Alexander Tokmakov
b134f53118 fix tests 2022-06-28 14:39:22 +02:00
Kruglov Pavel
25100ad5e5
Merge pull request #38520 from ClickHouse/Avogar-patch-1
Fix application errors grep in stress test
2022-06-28 14:26:22 +02:00
Alexander Tokmakov
2f45a6ebaa
Update test.py 2022-06-28 15:18:30 +03:00
Alexander Tokmakov
2386554746
Merge pull request #38490 from ClickHouse/test-handle-full-queue
Handle full queue exception in tests
2022-06-28 15:03:10 +03:00
Alexander Tokmakov
07cecd4e66
Merge pull request #38516 from ClickHouse/fix_flaky_store_cleanup
Try to fix flaky test
2022-06-28 14:56:54 +03:00
Robert Schulze
c22038d48b
More clang-tidy fixes 2022-06-28 11:50:05 +00:00
Miel Donkers
4e9f396a48
Small improvement of the error message to hint at possible issue (#38458) 2022-06-28 13:36:30 +02:00
Alexander Tokmakov
411512ed6f
Update run.sh 2022-06-28 14:28:06 +03:00
alesapin
c7620b8217 Use builder instead of disk 2022-06-28 13:19:30 +02:00
kssenii
4c99f608b3 Fix 2022-06-28 13:18:21 +02:00
Kruglov Pavel
f7419e0703
Fix application errors grep in stress test 2022-06-28 13:12:21 +02:00
Kruglov Pavel
ccdeaea2f0
Update 01378_alter_rename_with_ttl_zookeeper.sql 2022-06-28 13:06:49 +02:00
alesapin
a68bf8fff2 Missed changes 2022-06-28 12:59:54 +02:00
Mikhail f. Shiryaev
575366e37d
Merge pull request #38507 from ClickHouse/report-logging
A tiny improvement in report logging
2022-06-28 12:56:51 +02:00
Alexander Tokmakov
456e03758b
Update process_functional_tests_result.py 2022-06-28 13:52:39 +03:00
alesapin
0a3fab1cb6 Some sad changes 2022-06-28 12:51:49 +02:00
avogar
3b4ecc93bc Fix test and style 2022-06-28 10:48:20 +00:00
Alexander Tokmakov
e82a375946
Update Settings.h 2022-06-28 13:47:22 +03:00
Azat Khuzhin
9f147bde39 tests: allow 02305_schema_inference_with_globs to run in parallel
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-28 13:45:55 +03:00
Azat Khuzhin
1f42bf9bb3 tests: fix 02305_schema_inference_with_globs flakiness
Order of files on disk is not guarantee to match with:
- order of creation
- lexical order

So sometimes 02305_data4.jsonl comes first and 2 rows is enough to get
schema.

Reorganize checks a little to avoid flakiness.

Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-06-28 13:45:55 +03:00