[feature](mtmv)Support agg state roll up and optimize the roll up code#35026
Merged
morrySnow merged 8 commits intoapache:masterfrom May 24, 2024
Merged
[feature](mtmv)Support agg state roll up and optimize the roll up code#35026morrySnow merged 8 commits intoapache:masterfrom
morrySnow merged 8 commits intoapache:masterfrom
Conversation
|
Thank you for your contribution to Apache Doris. Since 2024-03-18, the Document has been moved to doris-website. |
Member
Author
|
run buildall |
ec53bd9 to
3ef7883
Compare
Member
Author
|
run buildall |
1 similar comment
Member
Author
|
run buildall |
morrySnow
reviewed
May 22, 2024
Comment on lines
+375
to
+380
| o 3 \ o,o,o,o,o,o, mi� ���"K?��DZW�_-�A�Vʧ��t�E | ||
| o 4 o,o, yy\r ���"K?��DZW | ||
|
|
||
| -- !query34_0_after -- | ||
| o 3 \ o,o,o,o,o,o, mi� ���"K?��DZW�_-�A�Vʧ��t�E | ||
| o 4 o,o, yy\r ���"K?��DZW |
Contributor
There was a problem hiding this comment.
agg state result is stable? i don't think so
|
|
||
| protected static final Multimap<Function, Expression> | ||
| AGGREGATE_ROLL_UP_EQUIVALENT_FUNCTION_MAP = ArrayListMultimap.create(); | ||
| public static List<AggFunctionRollUpHandler> ROLL_UP_HANDLERS = |
| protected static final Multimap<Function, Expression> | ||
| AGGREGATE_ROLL_UP_EQUIVALENT_FUNCTION_MAP = ArrayListMultimap.create(); | ||
| public static List<AggFunctionRollUpHandler> ROLL_UP_HANDLERS = | ||
| Lists.newArrayList(DirectRollupHandler.INSTANCE, |
Comment on lines
+292
to
+293
| Pair<Expression, Expression> mvExprToMvScanExprQueryBasedPair = Pair.of(expressionEntry.getKey(), | ||
| expressionEntry.getValue()); |
Contributor
There was a problem hiding this comment.
init out of inner for for better performance
4587789 to
6f79381
Compare
Member
Author
|
run buildall |
TPC-H: Total hot run time: 40088 ms |
TPC-DS: Total hot run time: 169528 ms |
ClickBench: Total hot run time: 30.19 s |
morrySnow
approved these changes
May 24, 2024
Contributor
|
PR approved by at least one committer and no changes requested. |
Contributor
|
PR approved by anyone and no changes requested. |
starocean999
approved these changes
May 24, 2024
yiguolei
pushed a commit
that referenced
this pull request
May 24, 2024
…de (#35026) agg_state is agg intermediate state, detail see state combinator: https://doris.apache.org/zh-CN/docs/dev/sql-manual/sql-functions/combinators/state this support agg function roll up as following +---------------------+---------------------------------------------+---------------------+ | query | materialized view | roll up | | ------------------- | ------------------------------------------- | ------------------- | | agg_funtion() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_merge() | | agg_funtion_unoin() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_union() | | agg_funtion_merge() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_merge() | +---------------------+---------------------------------------------+---------------------+ for example which can be rewritten by mv sucessfully as following MV defination is ``` select o_orderstatus, l_partkey, l_suppkey, sum_union(sum_state(o_shippriority)), group_concat_union(group_concat_state(l_shipinstruct)), avg_union(avg_state(l_linenumber)), max_by_union(max_by_state(l_shipmode, l_suppkey)), count_union(count_state(l_orderkey)), multi_distinct_count_union(multi_distinct_count_state(l_shipmode)) from lineitem left join orders on lineitem.l_orderkey = o_orderkey and l_shipdate = o_orderdate group by o_orderstatus, l_partkey, l_suppkey; ``` Query is ``` select o_orderstatus, l_suppkey, sum(o_shippriority), group_concat(l_shipinstruct), avg(l_linenumber), max_by(l_shipmode,l_suppkey), count(l_orderkey), multi_distinct_count(l_shipmode) from lineitem left join orders on l_orderkey = o_orderkey and l_shipdate = o_orderdate group by o_orderstatus, l_suppkey; ```
dataroaring
pushed a commit
that referenced
this pull request
May 26, 2024
…de (#35026) agg_state is agg intermediate state, detail see state combinator: https://doris.apache.org/zh-CN/docs/dev/sql-manual/sql-functions/combinators/state this support agg function roll up as following +---------------------+---------------------------------------------+---------------------+ | query | materialized view | roll up | | ------------------- | ------------------------------------------- | ------------------- | | agg_funtion() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_merge() | | agg_funtion_unoin() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_union() | | agg_funtion_merge() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_merge() | +---------------------+---------------------------------------------+---------------------+ for example which can be rewritten by mv sucessfully as following MV defination is ``` select o_orderstatus, l_partkey, l_suppkey, sum_union(sum_state(o_shippriority)), group_concat_union(group_concat_state(l_shipinstruct)), avg_union(avg_state(l_linenumber)), max_by_union(max_by_state(l_shipmode, l_suppkey)), count_union(count_state(l_orderkey)), multi_distinct_count_union(multi_distinct_count_state(l_shipmode)) from lineitem left join orders on lineitem.l_orderkey = o_orderkey and l_shipdate = o_orderdate group by o_orderstatus, l_partkey, l_suppkey; ``` Query is ``` select o_orderstatus, l_suppkey, sum(o_shippriority), group_concat(l_shipinstruct), avg(l_linenumber), max_by(l_shipmode,l_suppkey), count(l_orderkey), multi_distinct_count(l_shipmode) from lineitem left join orders on l_orderkey = o_orderkey and l_shipdate = o_orderdate group by o_orderstatus, l_suppkey; ```
seawinde
added a commit
to seawinde/doris
that referenced
this pull request
May 27, 2024
…de (apache#35026) agg_state is agg intermediate state, detail see state combinator: https://doris.apache.org/zh-CN/docs/dev/sql-manual/sql-functions/combinators/state this support agg function roll up as following +---------------------+---------------------------------------------+---------------------+ | query | materialized view | roll up | | ------------------- | ------------------------------------------- | ------------------- | | agg_funtion() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_merge() | | agg_funtion_unoin() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_union() | | agg_funtion_merge() | agg_funtion_unoin() or agg_funtion_state() | agg_funtion_merge() | +---------------------+---------------------------------------------+---------------------+ for example which can be rewritten by mv sucessfully as following MV defination is ``` select o_orderstatus, l_partkey, l_suppkey, sum_union(sum_state(o_shippriority)), group_concat_union(group_concat_state(l_shipinstruct)), avg_union(avg_state(l_linenumber)), max_by_union(max_by_state(l_shipmode, l_suppkey)), count_union(count_state(l_orderkey)), multi_distinct_count_union(multi_distinct_count_state(l_shipmode)) from lineitem left join orders on lineitem.l_orderkey = o_orderkey and l_shipdate = o_orderdate group by o_orderstatus, l_partkey, l_suppkey; ``` Query is ``` select o_orderstatus, l_suppkey, sum(o_shippriority), group_concat(l_shipinstruct), avg(l_linenumber), max_by(l_shipmode,l_suppkey), count(l_orderkey), multi_distinct_count(l_shipmode) from lineitem left join orders on l_orderkey = o_orderkey and l_shipdate = o_orderdate group by o_orderstatus, l_suppkey; ```
Closed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
agg_state is agg intermediate state, detail see state combinator
this support agg function roll up as following
for example which can be rewritten by mv sucessfully as following
mv def is
query is
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...