kssenii
862da8f459
Fix
2022-12-06 17:07:28 +01:00
Duc Canh Le
3b9c590a12
Merge branch 'master' into ch_canh_fix_normalize
2022-12-02 17:59:21 +08:00
Duc Canh Le
518058b92e
fix some bad logics in ast level optimization
2022-12-02 17:56:23 +08:00
Nikita Taranov
488610bd96
impl ( #43709 )
2022-11-29 18:22:24 +01:00
Smita Kulkarni
953e1068b5
Merge branch 'master' into 40907_Parameterized_views_as_table_functions
2022-11-28 19:10:32 +01:00
Smita Kulkarni
0545e24151
Updated to support query parameters in different parts of query (SELECT, ORDERBY, GROUP BY), updated the approach in WHERE & HAVING, added tests for the same - 40907 Parameterized views as table functions
2022-11-28 19:05:01 +01:00
Raúl Marín
4d3217cb18
Merge branch 'master' into perf_experiment
2022-11-24 10:32:12 +01:00
Antonio Andelic
c52ca6e10e
Merge branch 'master' into substitute-udf-create
2022-11-23 16:08:37 +00:00
Antonio Andelic
981e8a3a27
Modifiy visitor
2022-11-23 13:32:36 +00:00
Wangyang Guo
b08961be8a
LogicalExpressionsOptimizer: optimze for LowCardinality
2022-11-02 16:56:58 +08:00
Wangyang Guo
f4483ed19e
TreeRewriter: use well defined TablesWithColumns
2022-11-02 16:56:58 +08:00
taofengliu
d0767cab1d
GROUP BY ALL in Analyzer
2022-11-01 16:18:56 +08:00
Smita Kulkarni
9aa06e48f6
Merge branch 'master' into 40907_Parameterized_views_as_table_functions
2022-10-31 15:46:52 +01:00
taofengliu
82581b73ea
fix
2022-10-28 21:52:27 +08:00
taofengliu
7d1fbdbfeb
Merge remote-tracking branch 'upstream/master' into group_by_all
2022-10-28 21:48:56 +08:00
taofengliu
56ab264ec9
fix
2022-10-28 21:48:48 +08:00
Raúl Marín
6e0a9452e7
Merge remote-tracking branch 'blessed/master' into perf_experiment
2022-10-25 15:25:06 +02:00
Maksim Kita
40cb904a3d
Added support for JOIN, ARRAY JOIN
2022-10-24 10:22:19 +02:00
Smita Kulkarni
d8fe1d2d63
Moved is_create_parameterized_view out of Context , and added into ActionsMatcher::Data and SelectQueryInfo - 40907 Parameterized views as table functions
2022-10-21 14:45:28 +02:00
taofengliu
a7c1c69830
fix bug
2022-10-21 15:07:42 +08:00
taofengliu
abfa257e04
alias
2022-10-20 20:37:52 +08:00
taofengliu
4d5bf0e3b2
avoid extracting the deepest columns
2022-10-20 18:17:40 +08:00
Smita Kulkarni
e4ac3d0e18
Added FunctionParameterValuesVisitor, renamed bool to is_create_parameterized_view, added checks for parameterized view and support & test to propagate query parameters - 40907 Parameterized views as table functions
2022-10-19 18:30:03 +02:00
taofengliu
7c13110ab3
style
2022-10-19 12:15:43 +08:00
Alexey Milovidov
4440df6461
Update TreeRewriter.cpp
2022-10-19 03:00:09 +03:00
Raúl Marín
e60415d07d
Make clang-tidy happy
2022-10-18 11:40:12 +02:00
taofengliu
46739eeaf8
support GROUP BY ALL
2022-10-18 10:46:37 +08:00
Smita Kulkarni
3034229c37
Merge branch 'master' of github.com:ClickHouse/ClickHouse into 40907_Parameterized_views_as_table_functions
2022-10-17 18:37:31 +02:00
Smita Kulkarni
614fd4cf42
Added is_parameterized_view to Context and removed flag from ASTs, updated to use tryGetTable, addressed review comments - 40907 Parameterized views as table functions
2022-10-17 18:11:22 +02:00
Vitaly Baranov
91c438eebe
Merge pull request #42263 from vitlibar/refactor-udf
...
Refactor the implementation of user-defined functions
2022-10-15 12:33:10 +02:00
Vitaly Baranov
2e59d671fc
Split UserDefinedSQLObjectsLoader to interface and implementation.
2022-10-13 10:32:32 +02:00
Eridanus
0a80d451d2
Rewrite countDistinctIf with count_distinct_implementation configuration.
2022-10-04 17:23:28 +08:00
Alexey Milovidov
0e3b9bf3ff
Add more checkStackSize calls
2022-10-01 17:48:56 +02:00
Alexey Milovidov
9c5f9f1815
Merge pull request #41158 from den-crane/bug/trivial_count_optimization_with_array_join
...
Fix: trivial count optimization with array join. revert revert #39466
2022-09-12 08:56:10 +03:00
kssenii
2f3bfc5411
Fix
2022-09-11 13:54:25 +02:00
Denny Crane
be90cecbd2
Revert "Revert "Fix trivial count optimization with array join""
...
This reverts commit 17de7b2876
.
2022-09-09 14:56:38 -03:00
luocongkai
56e4179cad
fix bug when remove unneeded columns in subquery
2022-09-01 17:10:32 +08:00
Raúl Marín
32c63f43a1
Don't visit the AST for UDFs if none are registered
2022-08-10 17:54:56 +02:00
Nikolai Kochetov
658a269d56
Merge branch 'master' into use-dag-in-key-condition
2022-08-04 16:18:40 +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
Nikolai Kochetov
22fbfe19a4
Merge branch 'master' into use-dag-in-key-condition
2022-07-31 21:54:12 +02:00
kssenii
d66c108a04
Fix
2022-07-30 18:42:22 +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
8fc6bad4f4
Join enums refactoring
2022-07-29 18:35:05 +02:00
Nikolai Kochetov
59a11b32ad
Merge branch 'master' into use-dag-in-key-condition
2022-07-29 17:01:33 +02:00
Nikolai Kochetov
6919ae7c91
Fixing a test with indexHint
2022-07-28 12:24:16 +00:00
vdimir
96bcae419c
Cleanup logic around join_algorithm setting
2022-07-21 14:53:39 +00:00
kssenii
e6437f46b1
Fix
2022-07-16 22:23:49 +02:00
Vladimir C
db838f1343
Merge pull request #35796 from vdimir/full-sorting-merge-join
2022-07-07 19:16:49 +02:00
vdimir
4e88e8f5ec
full sort join: move block list to all join state
2022-07-06 14:26:17 +00:00
vdimir
fa8eb35599
Pipeline for full sorting merge join
2022-07-06 14:23:44 +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
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
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
mergify[bot]
670a63865e
Merge branch 'master' into window-function-expression
2022-06-19 22:14:54 +00:00
Dmitry Novik
376412e417
Small refactoring
2022-06-16 15:41:04 +00:00
Dmitry Novik
0663f07e67
Rework expressions with window functions
2022-06-16 13:29:56 +00:00
Maksim Kita
98a89b50ff
Use pdqsort instead of standard sort
2022-06-13 15:31:08 +02: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
Vladimir C
2a38fdb796
Merge pull request #37653 from vdimir/cross_join_dup_col_names
2022-05-31 17:50:19 +02: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
vdimir
8a3f4bda62
Fix columns number mismatch in cross join
2022-05-30 15:40:15 +00: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
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
Dmitry Novik
3a9239b79f
Revert "RFC: Fix converting types for UNION queries (may produce LOGICAL_ERROR)"
2022-05-27 04:05:32 +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
taiyang-li
c7e68d664d
fix building
2022-05-24 10:58:45 +08:00
taiyang-li
c120b19802
fix building
2022-05-23 17:42:20 +08:00
taiyang-li
9f3dadf17c
Merge branch 'master' into fix_settings
2022-05-17 16:19:29 +08:00
vdimir
9b24e0d260
Apply optimizeCountConstantAndSumOne before JOINs
2022-05-10 14:30:33 +00:00
taiyang-li
fd878f7e7b
change as requested
2022-05-10 12:06:50 +08:00
Maksim Kita
57444fc7d3
Merge pull request #36444 from rschu1ze/clang-tidy-fixes
...
Clang tidy fixes
2022-04-21 16:11:27 +02:00
Robert Schulze
b24ca8de52
Fix various clang-tidy warnings
...
When I tried to add cool new clang-tidy 14 warnings, I noticed that the
current clang-tidy settings already produce a ton of warnings. This
commit addresses many of these. Almost all of them were non-critical,
i.e. C vs. C++ style casts.
2022-04-20 10:29:05 +02:00
Robert Schulze
118e94523c
Activate clang-tidy warning "readability-container-contains"
...
This check suggests replacing <Container>.count() by
<Container>.contains() which is more speaking and in case of
multimaps/multisets also faster.
2022-04-18 23:53:11 +02:00
Yakov Olkhovskiy
7dbe8bc2dc
major bugs fixed, tests added, docs updated
2022-04-07 01:21:24 -04:00
vdimir
1122db89db
Use float devision for avg after optimize_fuse_sum_count_avg
2022-03-28 11:26:42 +00:00
Anton Popov
fcdebea925
Merge remote-tracking branch 'upstream/master' into HEAD
2022-02-25 13:41:30 +03:00
mergify[bot]
dd947f964c
Merge branch 'master' into mv_cacheable_scalars
2022-02-07 10:07:26 +00:00
Anton Popov
78b9f15abb
Merge remote-tracking branch 'upstream/master' into HEAD
2022-01-30 03:24:37 +03:00
Raúl Marín
4b5ab80e3b
Better scalar cache handling
...
- Fixes global CTE scalar cache.
- Adds MVs back (views dependent on the source are cached locally and others globally
2022-01-26 17:36:45 +01:00
Anton Popov
e8ce091e68
Merge remote-tracking branch 'upstream/master' into HEAD
2022-01-21 20:11:18 +03:00
Azat Khuzhin
97acf190ed
Replace old _shard_num implementation with shardNum() function
...
_shard_num via constant identifier (from #7624 ) has too much issues,
take a look at #16947 for example.
shardNum() function (from #27020 ) should works better.
This changes the behaviour of _shard_num slightly, now it returns nested
shard number in case of nested distributed tables (Distributed over
Distributed), but this should be minor.
v2: Rewrite _shard_num to shardNum() in TreeRewriter
2022-01-10 21:21:24 +03:00
Maksim Kita
ebff389701
Merge pull request #32972 from kitaisreal/containers-iteration-fix-erase
...
Containers iteration fix erase
2021-12-20 16:47:19 +03:00
Nikolai Kochetov
2e62f086a1
Merge pull request #32751 from ClickHouse/fix-32668
...
Apply some more optimizations to NO_QUERY ast.
2021-12-20 15:47:25 +03:00
Maksim Kita
3feab5a975
Containers iteration fix erase
2021-12-20 13:42:31 +03:00
Nikolai Kochetov
93a33d52dc
Merge branch 'fix-32668' of github.com:yandex/ClickHouse into fix-32668
2021-12-17 20:37:29 +03:00
Nikolai Kochetov
c8a92c046f
Another try
2021-12-17 20:36:37 +03:00
Anton Popov
99ebabd822
Merge remote-tracking branch 'upstream/master' into HEAD
2021-12-17 19:02:29 +03:00
Nikolai Kochetov
20b88d9b4c
Always apply const if optimixation.
2021-12-17 15:31:30 +03:00
mergify[bot]
3a7179756f
Merge branch 'master' into fix-32668
2021-12-15 08:31:10 +00:00
Nikolai Kochetov
d394f0e753
Allpy some more optimizations to NO_QUERY ast.
2021-12-14 17:19:18 +03:00
dongyifeng
9df664e1c9
fix bug when remove unneeded columns in subquery ( #32289 )
2021-12-07 11:09:39 +03:00
Anton Popov
6f4d9a53b2
Merge remote-tracking branch 'origin/sparse-serialization' into HEAD
2021-12-01 15:54:33 +03:00
Raúl Marín
7781fc12ed
Reduce dependencies on ASTSelectWithUnionQuery.h
...
521 -> 77 files requiring changes
2021-11-26 19:27:16 +01:00
Anton Popov
a20922b2d3
Merge remote-tracking branch 'origin/sparse-serialization' into HEAD
2021-11-09 15:36:25 +03:00
vdimir
56bc802ee2
Support join on constant
2021-11-08 15:44:13 +03:00
vdimir
08545795b5
Separate option for enabling fuse syntax for sum, avg, count
2021-11-03 15:13:09 +03:00
vdimir
039af96b61
Set execute_scalar_subqueries in MutationsInterpreter only for MergeTree and prepareInterpreterSelectQuery
2021-10-21 18:05:46 +03:00