Commit Graph

107 Commits

Author SHA1 Message Date
Alexey Milovidov
e1dc80b5ab
Revert "Support SAMPLE BY for VIEW" 2023-10-09 00:08:46 +03:00
Azat Khuzhin
5535c7462d Support SAMPLE BY for VIEW
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2023-09-10 08:24:46 +02:00
Smita Kulkarni
22fec136c1 Create new StorageView with substituted parameters for every SELECT query of a parameterized view 2023-07-25 14:04:55 +02:00
Smita Kulkarni
8a7bc3250d Added space to if expression of replaceQueryParameterWithValue function 2023-03-14 09:26:53 +01:00
Smita Kulkarni
4deeb13c6d Addressed review comments for parameterized view bug fix 2023-03-14 09:23:12 +01:00
Alexey Milovidov
38612635b0
Update StorageView.cpp 2023-03-12 20:43:47 +03:00
Smita Kulkarni
39a146ab87 Merge branch 'master' into Parameterized_view_bug_fix_47287_47247 2023-03-12 11:05:28 +01:00
Smita Kulkarni
e85096b444 Updated variable name to fix build & call to getSampleBlockForColumns. Added a test for substring parameter name. 2023-03-12 11:00:17 +01:00
Smita Kulkarni
5b11d72ce4 In parameterized view, moved parameter values to SelectQueryInfo from StorageView as it can be used by multiple queries and updated column name check to avoid issues with parameter name being substring of column name. 2023-03-11 20:39:43 +01:00
Maksim Kita
0358cb36d8 Fixed tests 2023-03-11 11:51:54 +01:00
Maksim Kita
a762112e15 Analyzer support distributed JOINS and subqueries in IN functions 2023-03-11 11:51:54 +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
Maksim Kita
44f4184e11
Merge pull request #44540 from kitaisreal/analyzer-support-distributed
Analyzer support distributed queries processing
2023-01-13 14:45:36 +03:00
Maksim Kita
a140d6c5b1 Fixed code review issues 2023-01-12 12:07:58 +01:00
Smita Kulkarni
0e743254df Removed no-parallel tag from test and removed an exception from StorageView - 40907 Parameterized views as table functions 2023-01-04 08:19:15 +01:00
Smita Kulkarni
1f89db78a5 Added is_create_parameterized_view flag in ActionsVisitor, added functions for column manipulation for parameterized view in StorageView, updated tests to fix flaky test issues and addressed small review comments- 40907 Parameterized views as table functions 2023-01-03 11:00:39 +01:00
SmitaRKulkarni
02ff2ea8ac
Merge branch 'master' into 40907_Parameterized_views_as_table_functions 2022-12-29 13:56:00 +01:00
SmitaRKulkarni
4d7459bd65
Merge branch 'master' into 40907_Parameterized_views_as_table_functions 2022-12-27 08:15:42 +01:00
Vladimir C
341d759837
Merge branch 'master' into remove-limits-on-maximum-result-for-view 2022-12-22 12:17:06 +01:00
Smita Kulkarni
5001cf9fa2 Updated to get column data type based not function , not the query parameter type , added test for the same - 40907 Parameterized views as table functions 2022-12-19 15:05:38 +01:00
Maksim Kita
52ad726124 Analyzer StorageView crash fix 2022-12-16 11:53:26 +01:00
lzydmxy
0a303433fc make no limits on the maximum size of the result for the view 2022-12-15 17:06:09 +08: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
2ef30d4343 Fixed clang-tidy build issue by making replaceQueryParametersIfParametrizedView static - 40907 Parameterized views as table functions 2022-11-11 19:39:18 +01:00
Smita Kulkarni
779b9197e3 Moved is_create_parameterized_view check inside finalize function and refactor check for isParmaeterizedView when replacing subquery - 40907 Parameterized views as table functions 2022-11-08 11:03:40 +01:00
Smita Kulkarni
9aa06e48f6 Merge branch 'master' into 40907_Parameterized_views_as_table_functions 2022-10-31 15:46:52 +01:00
Azat Khuzhin
4e76629aaf Fixes for -Wshorten-64-to-32
- lots of static_cast
- add safe_cast
- types adjustments
  - config
  - IStorage::read/watch
  - ...
- some TODO's (to convert types in future)

P.S. That was quite a journey...

v2: fixes after rebase
v3: fix conflicts after #42308 merged
Signed-off-by: Azat Khuzhin <a.khuzhin@semrush.com>
2022-10-21 13:25:19 +02: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
e5c0c6a1b6 Addressed review comments - 40907 Parameterized views as table functions
Implementation
* Updated handling of has_query_parameters to avoid recalculation.
* Fixed style comments
* Updated formatImpl of ASTTableExpression to prioritise table_function before sub_query.
Testing:
* Added test for ATTACH, DETACH, INSERT INTO view and EXPLAIN SYNTAX to tests/queries/0_stateless/02428_parameterized_view.sql
2022-10-03 14:27:38 +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
Duc Canh Le
018f4118bb
Fix view with merge table function (#40734) 2022-09-01 12:20:00 +02:00
Vitaly Baranov
fbb2e14d54 Add new table function viewIfPermitted(). 2022-07-15 15:44:29 +02:00
Nikolai Kochetov
147a819221 Refactor a little bit more. 2022-05-31 14:43:38 +00:00
Nikolai Kochetov
c71256ea38 Remove some commented code. 2022-05-30 13:18:20 +00:00
Nikolai Kochetov
fd97a9d885 Move some resources 2022-05-23 19:47:32 +00:00
Nikolai Kochetov
56feef01e7 Move some resources 2022-05-20 19:49:31 +00:00
Robert Schulze
330212e0f4
Remove inherited create() method + disallow copying
The original motivation for this commit was that shared_ptr_helper used
std::shared_ptr<>() which does two heap allocations instead of
make_shared<>() which does a single allocation. Turned out that
1. the affected code (--> Storages/) is not on a hot path (rendering the
performance argument moot ...)
2. yet copying Storage objects is potentially dangerous and was
   previously allowed.

Hence, this change

- removes shared_ptr_helper and as a result all inherited create() methods,

- instead, Storage objects are now created using make_shared<>() by the
  caller (for that to work, many constructors had to be made public), and

- all Storage classes were marked as noncopyable using boost::noncopyable.

In sum, we are (likely) not making things faster but the code becomes
cleaner and harder to misuse.
2022-05-02 08:46:52 +02:00
Anton Popov
e8ce091e68 Merge remote-tracking branch 'upstream/master' into HEAD 2022-01-21 20:11:18 +03:00
hexiaoting
5c847264f7 Fix bug for select from VIEW with format and limit settings 2022-01-11 20:19:41 +08: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
b2cfa70541 Reduce dependencies on ASTFunction.h
481 -> 230
2021-11-26 18:21:54 +01:00
Raúl Marín
051dddd8df Reduce dependencies on ASTIdentifier.h
Goes from rebuilding 483 objects to 165 when it's modified
2021-11-26 16:49:40 +01:00
Anton Popov
a20922b2d3 Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-11-09 15:36:25 +03:00
Nikolai Kochetov
a08c98d760 Move some files. 2021-10-16 17:03:50 +03:00
Nikolai Kochetov
998d29ebc7 Merge branch 'master' into rewrite-pushing-to-views 2021-09-23 13:10:27 +03:00
hhell
fc166570d8
Fix typo in an error message
Related: https://github.com/ClickHouse/ClickHouse/issues/20551
2021-09-22 21:33:15 +03:00
Nikolai Kochetov
999a4fe831 Fix other tests. 2021-09-08 21:29:38 +03:00
Anton Popov
61239343e3 Merge remote-tracking branch 'origin/sparse-serialization' into HEAD 2021-08-20 16:33:30 +03:00