seawinde opened a new pull request, #36278:
URL: https://github.com/apache/doris/pull/36278
## Proposed changes
Support query rewrite by materialized view when query is aggregate and
materialized view has no aggregate
this maybe improve query spped, because it can save expression evaluation by
use the expression result in materialized view.
this also support single table rewrite.
For example as follwoing:
mv def is:
> CREATE MATERIALIZED VIEW mv1
> BUILD IMMEDIATE REFRESH COMPLETE ON MANUAL
> DISTRIBUTED BY RANDOM BUCKETS 2
> PROPERTIES ('replication_num' = '1')
> AS
> select case when o_shippriority > 1 and o_orderkey IN (4, 5)
then o_custkey else o_shippriority end,
> o_orderstatus,
> bin(o_orderkey),
> l_suppkey,
> l_linenumber
> from orders
> left join lineitem on o_orderkey = l_orderkey;
the query as following can be rewritten by mv successfully
> select
> count(case when o_shippriority > 1 and o_orderkey IN (4, 5)
then o_custkey else o_shippriority end) as count_case,
> o_orderstatus,
> bin(o_orderkey)
> from orders
> left join lineitem on o_orderkey = l_orderkey
> where l_linenumber = 4
> group by
> o_orderstatus,
> bin(o_orderkey);
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]