englefly opened a new pull request, #16601:
URL: https://github.com/apache/doris/pull/16601
# Proposed changes
In previous version, if the output slot of analyticExpr is not materialized,
the analyticExpr is pruned.
But there are some cases that it cannot be pruned.
For example:
```
SELECT
count(*)
FROM T1,
(SELECT dd
FROM (
SELECT
1.1 as cc,
ROW_NUMBER() OVER() as dd
FROM T2
) V1
ORDER BY cc DESC
limit 1
) V2;
```
analyticExpr(ROW_NUMBER() OVER() as dd) is not materialized,
but we have to generate
WindowGroup for it.
tmp.dd is used by upper count(*), we have to generate data for
tmp.dd
In order to prune 'ROW_NUMBER() OVER() as dd', we need to
rethink the rule of choosing a column
for count(*). (refer to
SingleNodePlanner.materializeTableResultForCrossJoinOrCountStar)
V2 can be transformed to
```
SELECT cc
FROM (
SELECT
1.1 as cc,
ROW_NUMBER() OVER() as dd
FROM T2
) V1
ORDER BY cc DESC
limit 1
) V2;
```
Except the byte size of cc and dd, we need to consider the cost
to generate cc and dd.
Issue Number: close #xxx
## Problem summary
Describe your changes.
## Checklist(Required)
1. Does it affect the original behavior:
- [ ] Yes
- [ ] No
- [ ] I don't know
2. Has unit tests been added:
- [ ] Yes
- [ ] No
- [ ] No Need
3. Has document been added or modified:
- [ ] Yes
- [ ] No
- [ ] No Need
4. Does it need to update dependencies:
- [ ] Yes
- [ ] No
5. Are there any changes that cannot be rolled back:
- [ ] Yes (If Yes, please explain WHY)
- [ ] No
## Further comments
If this is a relatively large or complex change, kick off the discussion at
[[email protected]](mailto:[email protected]) by explaining why you
chose the solution you did and what alternatives you considered, etc...
--
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]