-
Notifications
You must be signed in to change notification settings - Fork 3.7k
[feat](Nereids): lazy get expression map when comparing hypergraph #34753
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
|
run buildall |
TPC-H: Total hot run time: 39939 ms |
TPC-DS: Total hot run time: 186290 ms |
|
run buildall |
TPC-H: Total hot run time: 41725 ms |
TPC-DS: Total hot run time: 187401 ms |
|
run buildall |
|
run buildall |
| queryToViewAllExpressionMapping.putAll(getQueryToViewFilterEdgeExpressionMapping()); | ||
| return queryToViewAllExpressionMapping; | ||
| public Expression getQueryJoinExprFromView(Expression viewJoinExpr) { | ||
| return queryToViewJoinEdgeExpressionMappingSupplier.get().inverse().get(viewJoinExpr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
inverse() need calc, Maybe we should construct viewToQueryJoinEdgeExpressionMapping field in context for performance
| } | ||
|
|
||
| public Expression getQueryFilterExprFromView(Expression viewJoinExpr) { | ||
| return queryToViewFilterEdgeExpressionMappingSupplier.get().inverse().get(viewJoinExpr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same as above
| public BiMap<Expression, Expression> getQueryToViewNodeExpressionMapping() { | ||
| return queryToViewNodeExpressionMappingSupplier.get(); | ||
| public Expression getQueryNodeExpFromView(Expression viewJoinExpr) { | ||
| return queryToViewNodeExpressionMappingSupplier.get().inverse().get(viewJoinExpr); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the same as above
|
run buildall |
|
PR approved by anyone and no changes requested. |
|
run performance |
|
PR approved by at least one committer and no changes requested. |
…by materialized view fail (#44575) Such as mv def is as following and query is the same this is the same filter `l_orderkey is null or l_orderkey <> 1` but they are in the different position. this would cause rewrite fail, this pr fix this. ```sql select o_custkey, o_orderdate, o_shippriority, o_comment, o_orderkey, orders.public_col as col1, l_orderkey, l_partkey, l_suppkey, lineitem.public_col as col2, ps_partkey, ps_suppkey, partsupp.public_col as col3, partsupp.public_col * 2 as col4, o_orderkey + l_orderkey + ps_partkey * 2, sum( o_orderkey + l_orderkey + ps_partkey * 2 ), count() as count_all from ( select o_custkey, o_orderdate, o_shippriority, o_comment, o_orderkey, orders.public_col as public_col from orders ) orders left join ( select l_orderkey, l_partkey, l_suppkey, lineitem.public_col as public_col from lineitem where l_orderkey is null or l_orderkey <> 1 ) lineitem on l_orderkey = o_orderkey inner join ( select ps_partkey, ps_suppkey, partsupp.public_col as public_col from partsupp ) partsupp on ps_partkey = o_orderkey and ps_suppkey = o_custkey where l_orderkey is null or l_orderkey <> 1 group by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14; ``` Related PR: #34753 Fix filter position different but same causing rewritten by materialized view fail
…by materialized view fail (#44575) Such as mv def is as following and query is the same this is the same filter `l_orderkey is null or l_orderkey <> 1` but they are in the different position. this would cause rewrite fail, this pr fix this. ```sql select o_custkey, o_orderdate, o_shippriority, o_comment, o_orderkey, orders.public_col as col1, l_orderkey, l_partkey, l_suppkey, lineitem.public_col as col2, ps_partkey, ps_suppkey, partsupp.public_col as col3, partsupp.public_col * 2 as col4, o_orderkey + l_orderkey + ps_partkey * 2, sum( o_orderkey + l_orderkey + ps_partkey * 2 ), count() as count_all from ( select o_custkey, o_orderdate, o_shippriority, o_comment, o_orderkey, orders.public_col as public_col from orders ) orders left join ( select l_orderkey, l_partkey, l_suppkey, lineitem.public_col as public_col from lineitem where l_orderkey is null or l_orderkey <> 1 ) lineitem on l_orderkey = o_orderkey inner join ( select ps_partkey, ps_suppkey, partsupp.public_col as public_col from partsupp ) partsupp on ps_partkey = o_orderkey and ps_suppkey = o_custkey where l_orderkey is null or l_orderkey <> 1 group by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14; ``` Related PR: #34753 Fix filter position different but same causing rewritten by materialized view fail
…by materialized view fail (#44575) Such as mv def is as following and query is the same this is the same filter `l_orderkey is null or l_orderkey <> 1` but they are in the different position. this would cause rewrite fail, this pr fix this. ```sql select o_custkey, o_orderdate, o_shippriority, o_comment, o_orderkey, orders.public_col as col1, l_orderkey, l_partkey, l_suppkey, lineitem.public_col as col2, ps_partkey, ps_suppkey, partsupp.public_col as col3, partsupp.public_col * 2 as col4, o_orderkey + l_orderkey + ps_partkey * 2, sum( o_orderkey + l_orderkey + ps_partkey * 2 ), count() as count_all from ( select o_custkey, o_orderdate, o_shippriority, o_comment, o_orderkey, orders.public_col as public_col from orders ) orders left join ( select l_orderkey, l_partkey, l_suppkey, lineitem.public_col as public_col from lineitem where l_orderkey is null or l_orderkey <> 1 ) lineitem on l_orderkey = o_orderkey inner join ( select ps_partkey, ps_suppkey, partsupp.public_col as public_col from partsupp ) partsupp on ps_partkey = o_orderkey and ps_suppkey = o_custkey where l_orderkey is null or l_orderkey <> 1 group by 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14; ``` Related PR: #34753 Fix filter position different but same causing rewritten by materialized view fail
Proposed changes
lazy get ExpressionMap when comparing hypergraph
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...