Commit Graph

126 Commits

Author SHA1 Message Date
Zhiguo Zhou
773a5bbbaa Optimize predicate with toYear converter
The date converters, such as toYear, are widely used in the where
clauses of the SQL queries, however, these conversions are often
expensive due to the complexity of the calendar system.

The function preimage is found an optimization for the predicates
with the converters. Given a predicate, toYear(c) = y, we could
convert it to its equivalent form: c >= b AND c <= e, where b is
"y-01-01" and e is "y-12-31". The similar transformation applies
to other comparisons (<>, <, >, <=, <=).

This commit implemented the above transformation at the AST level
by adding a new pass in the TreeOptimizer and a new AST visitor
for in-place replacing the predicates of toYear with the converted
ones.
2023-05-25 09:11:51 +08:00
Anton Popov
f8905acb46 fix crash with multiif and constant condition and nullable arguments 2023-05-22 23:31:50 +00:00
taiyang-li
e1fed0352e remove useless code 2023-02-09 16:32:11 +08:00
taiyang-li
af7a6abf80 fix bugs 2023-02-09 15:15:08 +08:00
taiyang-li
48f0fb0d52 rewrite array exists to has 2023-02-09 12:06:42 +08:00
Alexander Tokmakov
70d1adfe4b
Better formatting for exception messages (#45449)
* save format string for NetException

* format exceptions

* format exceptions 2

* format exceptions 3

* format exceptions 4

* format exceptions 5

* format exceptions 6

* fix

* format exceptions 7

* format exceptions 8

* Update MergeTreeIndexGin.cpp

* Update AggregateFunctionMap.cpp

* Update AggregateFunctionMap.cpp

* fix
2023-01-24 00:13:58 +03:00
vdimir
17c1ec8240
Remove optimizeFuseQuantileFunctions 2022-12-29 14:43:33 +00: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
Vitaly Baranov
2e59d671fc Split UserDefinedSQLObjectsLoader to interface and implementation. 2022-10-13 10:32:32 +02:00
Igor Nikonov
d8acb0e7ad Tiny improvements along the code
- less allocations (potentially)
2022-09-13 12:06:56 +00:00
Alexey Milovidov
940a53e519
Merge pull request #40984 from Lucky-Chang/typo_fix
Fix some typos and clang-tidy warnings
2022-09-06 02:37:50 +03:00
Luck-Chang
1ac8e739c9 fix some typos and clang-tidy warnings 2022-09-05 09:50:24 +08:00
Antonio Andelic
e64436fef3 Fix typos with new codespell 2022-09-02 08:54:48 +00:00
Igor Nikonov
9eef299e11
Merge pull request #39103 from tonickkozlov/tonickkozlov/37032/do-not-optimize-functions-shadowing-args
Do not optimize GROUP BY functions that shadow their arguments
2022-08-03 15:06:42 +02:00
Anton Kozlov
ce70f3dacb fixed 02303_query_kind test; added logging in 02352_grouby_shadows_arg test 2022-08-02 10:50:27 +00:00
Amos Bird
5ad8314367
Combining sumIf->countIf and multiIf->if opt. 2022-07-26 23:55:13 +08:00
Anton Kozlov
0e44e34e69 Do not optimize GROUP BY functions that shadow their arguments 2022-07-21 11:33:48 +00:00
Anton Popov
00f87b0f57 replace multiIf to if in case of one condition 2022-05-31 14:45:12 +00:00
Dmitry Novik
c4dc0f7cda Fix ORDER BY optimization in case of GROUPING SETS 2022-05-24 18:56:22 +00:00
Alexey Milovidov
8334329dff
Merge pull request #37023 from ClickHouse/chained-or
Merging #34932.
2022-05-15 04:32:31 +03:00
Nikolai Kochetov
55188665f4
Merge pull request #37071 from ClickHouse/join_dup_columns_issue_contin
Continue fixing #36199.
2022-05-12 11:36:15 +02:00
vdimir
9b24e0d260
Apply optimizeCountConstantAndSumOne before JOINs 2022-05-10 14:30:33 +00:00
Alexey Milovidov
56abce6a75 Merge branch 'chained_or' of github.com:danlark1/ClickHouse into chained-or 2022-05-08 23:37:09 +02:00
Dmitry Novik
4cc26aa38b Merge remote-tracking branch 'origin/master' into grouping-sets-fix
And fix execution of the query with only one grouping set
2022-05-05 17:14:52 +00:00
Alexey Milovidov
fe004c3486
Merge pull request #36486 from kitaisreal/executable-user-defined-functions-fix-group-by
ExecutableUserDefinedFunction fix usage in GROUP BY
2022-04-24 06:11:57 +03:00
Maksim Kita
485c1d4072 Fixed tests 2022-04-21 19:10:11 +02:00
Maksim Kita
57444fc7d3
Merge pull request #36444 from rschu1ze/clang-tidy-fixes
Clang tidy fixes
2022-04-21 16:11:27 +02:00
Maksim Kita
397603e9be ExecutableUserDefinedFunction fix usage in GROUP BY 2022-04-21 13:44:56 +02:00
Dmitry Novik
61deae7105
Merge branch 'master' into grouping-sets-fix 2022-04-21 03:34:42 +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
Dmitry Novik
a16710c750 Merge remote-tracking branch 'origin/master' into grouping-sets-fix 2022-04-14 17:29:51 +00:00
李扬
d28981e0e3
fix null pointer of TreeRewriterResult::storage_snapshot (#35439) 2022-03-20 21:07:58 +01:00
Danila Kutenin
7b91e62ae0 Transform OR LIKE chain to multiMatchAny
Closes #5895
2022-02-27 16:55:02 +00:00
Anton Popov
e8ce091e68 Merge remote-tracking branch 'upstream/master' into HEAD 2022-01-21 20:11:18 +03:00
Dmitry Novik
1095814bbf Cleanup code 2022-01-11 11:26:13 +00:00
fanzhou
912338629e grouping sets support multiple group 2022-01-11 11:26:11 +00:00
MaxTheHuman
c7c2093bd9 grouping sets: make simple aggregation with grouping sets to work 2022-01-11 11:26:11 +00:00
MaxTheHuman
390c8126a4 development 2022-01-11 11:26:10 +00:00
alexey-milovidov
0a55fa3dc2
Revert "Grouping sets dev" 2021-12-25 20:30:31 +03:00
alexey-milovidov
6b97af4c63
Merge pull request #26869 from taylor12805/grouping-sets-dev
Grouping sets dev
2021-12-17 20:50:15 +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
Dmitry Novik
56a3f4a000 Cleanup code 2021-12-14 22:15:14 +03:00
Anton Popov
745fd4fc16 fix reading in order from Distributed and Merge tables 2021-12-13 15:35:25 +03:00
fanzhou
2912344896 grouping sets support multiple group 2021-11-29 18:32:55 +03:00
MaxTheHuman
4f07ec2659 grouping sets: make simple aggregation with grouping sets to work 2021-11-26 22:59:56 +03:00
MaxTheHuman
3418de337a development 2021-11-26 20:37:51 +03:00