[feature](nereids) Support to get partition related table from mv and check the query operator#28064
Conversation
… check the query operator
|
run buildall |
| * @param materializedViewPlan this should be rewritten or analyzed plan, should not be physical plan. | ||
| * @param column ref column name. | ||
| */ | ||
| public static RelatedTableInfo getRelatedTableInfo(String column, Plan materializedViewPlan) { |
There was a problem hiding this comment.
The return value may be empty, is Optional more appropriate?
| */ | ||
| public static final class RelatedTableInfo { | ||
| private BaseTableInfo tableInfo; | ||
| private boolean pctPossible; |
There was a problem hiding this comment.
pct: partition change tracking, if true can partition increment build or not
|
run buildall |
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G' |
|
(From new machine)TeamCity pipeline, clickbench performance test result: |
|
PR approved by anyone and no changes requested. |
TPC-H test result on machine: 'aliyun_ecs.c7a.8xlarge_32C64G' |
|
PR approved by at least one committer and no changes requested. |
… check the query operator (apache#28064) Function 1: check the select query plan is contain the stmt as following or not SELECT [hint_statement, ...] [ALL | DISTINCT | DISTINCTROW | ALL EXCEPT ( col_name1 [, col_name2, col_name3, ...] )] elect_expr [, select_expr ...] [FROM table_references PARTITION partition_list] [TABLET tabletid_list] [TABLESAMPLE sample_value [ROWS | PERCENT] [REPEATABLE pos_seek]] [WHERE where_condition] [GROUP BY [GROUPING SETS | ROLLUP | CUBE] {col_name | expr | position}] [HAVING where_condition] [ORDER BY {col_name | expr | position} [ASC | DESC], ...] [LIMIT {[offset,] row_count | row_count OFFSET offset}] [INTO OUTFILE 'file_name'] if analyzedPlan contains the stmt as following [PARTITION partition_list] [TABLET tabletid_list] or [TABLESAMPLE sample_value [ROWS | PERCENT] [REPEATABLE pos_seek]] this method will return true. Function 2: Get related base table info which materialized view plan column reference, input param plan should be rewritten plan that sub query should be eliminated
…LESAMPLE or tablet and so on (#43030) Related PR: #28064 Materialized view is as following: CREATE MATERIALIZED VIEW mv1 BUILD IMMEDIATE REFRESH AUTO ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select * from orders If run query as following, should rewrite fail by materialized view above to make sure data correctness select * from orders TABLET(110); select * from orders index query_index_test; select * from orders TABLESAMPLE(20 percent); select * from orders_partition PARTITION (day_2); At before, this would rewrite by materialized view succesfully and the result data is wrong, This pr fix this.
…LESAMPLE or tablet and so on (#43030) Related PR: #28064 Materialized view is as following: CREATE MATERIALIZED VIEW mv1 BUILD IMMEDIATE REFRESH AUTO ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select * from orders If run query as following, should rewrite fail by materialized view above to make sure data correctness select * from orders TABLET(110); select * from orders index query_index_test; select * from orders TABLESAMPLE(20 percent); select * from orders_partition PARTITION (day_2); At before, this would rewrite by materialized view succesfully and the result data is wrong, This pr fix this.
…LESAMPLE or tablet and so on (apache#43030) Related PR: apache#28064 Materialized view is as following: CREATE MATERIALIZED VIEW mv1 BUILD IMMEDIATE REFRESH AUTO ON MANUAL DISTRIBUTED BY RANDOM BUCKETS 2 PROPERTIES ('replication_num' = '1') AS select * from orders If run query as following, should rewrite fail by materialized view above to make sure data correctness select * from orders TABLET(110); select * from orders index query_index_test; select * from orders TABLESAMPLE(20 percent); select * from orders_partition PARTITION (day_2); At before, this would rewrite by materialized view succesfully and the result data is wrong, This pr fix this.
Proposed changes
Function 1
check the select query plan is contain the stmt as following or not
Function 2
Further comments
If this is a relatively large or complex change, kick off the discussion at dev@doris.apache.org by explaining why you chose the solution you did and what alternatives you considered, etc...