Commit Graph

36 Commits

Author SHA1 Message Date
vdimir
d7c77420b6
QueryNormalizer only checks stack size 2023-10-16 10:33:04 +00:00
vdimir
ba5cd016dd
Fix crash in QueryNormalizer with cyclic aliases 2023-10-13 14:03:36 +00:00
Raúl Marín
87a4fb0252 Update aliases when clone happens 2023-02-20 19:08:54 +01:00
Raúl Marín
2273acaa30 Fix incorrect alias recursion in QueryNormalizer 2023-02-20 16:51:52 +01: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
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
Smita Kulkarni
4dec8337f0 Merge branch 'master' into 40907_Parameterized_views_as_table_functions 2022-11-11 19:04:35 +01:00
Smita Kulkarni
3e5f1a9178 Added is_parameterized_view in ASTFunction and fixed review comments - 40907 Parameterized views as table functions 2022-11-07 15:22:45 +01:00
Smita Kulkarni
4c70622202 Updated to check size of alias before cloning, so that we throw error early - 42452 Bug fix for parent node corrupted 2022-11-03 14:42:34 +01:00
Smita Kulkarni
9a002bd378 Removed finished_asts updation when alias is replaced and updated alias of the replaced ast it its initial name so that we don’t replace it further - 42452 Bug fix for parent node corrupted 2022-11-03 11:57:32 +01:00
Smita Kulkarni
816f2319f7 Updated finished_asts to fix fast test fails with Normalise AST is too deep and updated ConvertFunctionOrLikeData to merge conditions by aliasorColumnName instead of ASTPtr - 42452 Bug fix for parent node corrupted 2022-11-02 19:35:22 +01:00
Smita Kulkarni
c97c78e3ff Updated normaliser to clone the alias ast.
Implementation:
* Updated QueryNormalizer to clone alias ast, when its replaced. Previously just assigning the same leads to exception in LogicalExpressinsOptimizer as it would be the same parent being inserted again.
* This bug is not seen with new analyser (allow_experimental_analyzer), so no changes for it. I added a test for the same.
Testing:
* Added a test for or function with alias and const where 02475_or_function_alias_and_const_where.sql
2022-10-31 13:49:31 +01: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
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
Smita Kulkarni
bbc33a54b2 Addressed review comments - 40907 Parameterized views as table functions
Implementation
* Fix for clang-today build fails - updated to use const in Context.cpp & const function in ActionsVisitior.cpp
* Updated to use QueryParameterVisitor to check if query has query parameters
* Updated executeTableFunction to check if table/table exists instead of try-catch approach
* Fixed small review comments and style comments.
Documentation:
* Addressed review comments and added the LIVE view part which was removed by mistake in the previous commits.
2022-09-27 16:30:59 +02:00
Smita Kulkarni
f801772a86 40907 Parameterized views as table functions
Implementation:
* Updated parsers by adding a bool allow_query_parameters while creating ordinary view, which is used in interpreters to allow query parameters in SELECT.
* Added a check in ActionsVisitor if multiple parameters have same names while creating parameterised view.
* Added bool in StorageView to represent parameterized view.
* Updated processing of SELECT with parameter values to check for views and added substitution of values in the query parameters.

Testing:
* Added a test tests/queries/0_stateless/02428_parameterized_view.sql

Documentation:
* Updated the english documentation for VIEW.
2022-09-23 14:04:43 +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
7293e01647 some comments added 2022-04-11 09:47:27 -04:00
Yakov Olkhovskiy
64dcddc6e3 fixed ASTInterpolateElement::clone, fixed QueryNormalizer to exclude ASTInterpolateElement::children 2022-04-07 17:41:05 -04:00
abel-wang
ec0ee2cecf Replace parameters in ASTFunctions with alias. 2021-08-10 23:22:33 +08:00
Raúl Marín
8b9778ebb6 Shadow lambda arguments
In case of ambiguity, lambda functions should prefer its arguments to
other aliases or identifiers
2021-08-05 18:52:00 +02:00
alesapin
5284f192ee Ban loop aliases in table definitions 2021-06-07 23:59:38 +03:00
Maksim Kita
ffdc2b22a5
Merge pull request #24022 from amosbird/fixalias
Make `prefer_column_name_to_alias` setting more standard
2021-05-12 09:54:04 +03:00
Amos Bird
62153e7030
Fix 2021-05-12 02:30:16 +08:00
Amos Bird
264cff6415
Projections
TODO (suggested by Nikolai)

1. Build query plan fro current query (inside storage::read) up to WithMergableState
2. Check, that plan is simple enough: Aggregating - Expression - Filter - ReadFromStorage (or simplier)
3. Check, that filter is the same as filter in projection, and also expression calculates the same aggregation keys as in projection
4. Return WithMergableState if projection applies

3 will be easier to do with ActionsDAG, cause it sees all functions, and dependencies are direct (but it is possible with ExpressionActions also)

Also need to figure out how prewhere works for projections, and
row_filter_policies.

wip
2021-05-11 18:12:23 +08:00
Amos Bird
69204e1d21
Add prefer_column_name_to_alias settings (#22044) 2021-03-30 16:51:45 +03:00
Alexander Kuzmenkov
703731c547 something works 2021-01-13 22:29:52 +03:00
Alexander Kuzmenkov
1c52fdb265 cleanup 2020-12-28 13:08:38 +03:00
Alexander Kuzmenkov
2905f70cce fix aliases in partition by/order by 2020-12-28 12:56:38 +03:00
Alexander Kuzmenkov
998bd17877 fix column name clash w/agg fns
also fix some test references influenced by the explain changes
2020-12-25 07:59:17 +03:00
Ivan
315ff4f0d9
ANTLR4 Grammar for ClickHouse and new parser (#11298) 2020-12-04 05:15:44 +03:00
Ivan
1d170f5745
ASTTableIdentifier Part #1: improve internal representation of ASTIdentifier name (#16149)
* Use only |name_parts| as primary name source

* Restore legacy logic for table restoration

* Fix build

* Fix tests

* Add pytest server config

* Fix tests

* Fixes due to review
2020-10-24 21:46:10 +03:00
Amos Bird
b40998ca00
Treat query as function argument. 2020-09-09 15:41:38 +08:00
Amos Bird
6bd753d85d
TableFunction view. 2020-09-02 16:02:10 +08:00
Alexey Milovidov
0a7edce036 Checkpoint 2020-04-22 09:01:33 +03:00
Ivan Lezhankin
06446b4f08 dbms/ → src/ 2020-04-03 18:14:31 +03:00