planner, CTE: Fix default inline CTE which contains agg or window function and refactor inline CTE strategy | tidb-test=pr/2239#48188
Conversation
…ction and refactor inline cte stratagy
|
Hi @elsa0520. Thanks for your PR. PRs from untrusted users cannot be marked as trusted with I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test all |
|
@elsa0520: Cannot trigger testing until a trusted user reviews the PR and leaves an DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/cherry-pick release-7.5 |
|
@elsa0520: once the present PR merges, I will cherry-pick it on top of release-7.5 in the new PR and assign it to you. DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #48188 +/- ##
================================================
+ Coverage 71.5890% 72.8250% +1.2360%
================================================
Files 1400 1425 +25
Lines 405903 413333 +7430
================================================
+ Hits 290582 301010 +10428
+ Misses 95511 93396 -2115
+ Partials 19810 18927 -883
Flags with carried forward coverage won't be shown. Click here to find out more.
|
There was a problem hiding this comment.
- We need some test cases.
- Another bad case:
explain
with a as (select count(*) as id from dual),
b as (select 2 as bb from a),
c as (
with recursive tmp as (select 1 as res from dual union all select res+1 from tmp,b where res+1 < bb)
select * from tmp
)
select * from c;For the new bad case, I think it's caused by the maintenance of buildingRecursivePartForCTE, and the current implementation doesn't process the setting and resetting properly.
| // isInline will determine whether it can be inlined when **CTE is used** | ||
| isInline bool |
There was a problem hiding this comment.
I think we can remove this field now.
Because it's no longer a property of a cte, it's checked every time we use the cte.
There was a problem hiding this comment.
This property should be record in cte because the tryToBuildSequence use it later ~
There was a problem hiding this comment.
But it seems the isInline now is not correct anymore according to the rationale of this PR. 🤔
If we want to know if it's expected by the user to inline this CTE there, we should use the new forceInlineByHintOrVar. If we want to know if it really can be inlined, we should go through the new checking logic introduced in this PR.
There was a problem hiding this comment.
In tryToBuildSequence, it looks like isInline actually means "whether this CTE is really inlined in the most recent buildWith call for this CTE".
There was a problem hiding this comment.
If my understanding is correct, I think we at least need some comments to clarify this.
|
Also, there are a lot of failures in the CI, please take a look. |
Cover this case and add more tests ~ |
|
/test unit-test |
|
@elsa0520: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test check_dev_2 |
|
@elsa0520: The specified target(s) for
The following commands are available to trigger optional jobs:
Use
DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
@elsa0520: The specified target(s) for
Use DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test mysql-test |
|
@elsa0520: The specified target(s) for
Use DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test mysql-test |
|
@elsa0520: The specified target(s) for
Use DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
/test mysql-test |
|
@elsa0520: The specified target(s) for
Use DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
Will also close #47603 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: qw4990, YangKeao The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest |
|
/test mysql-test |
|
@elsa0520: The specified target(s) for
Use DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
|
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
|
In response to a cherrypick label: new pull request created to branch |
|
In response to a cherrypick label: new pull request created to branch |
Signed-off-by: ti-chi-bot <ti-community-prow-bot@tidb.io>
What problem does this PR solve?
Issue Number: close #47711
close #47603
Problem Summary:
What is changed and how it works?
Refactor
Unified inline strategy logic in CTE used.
consumerCount, forceInlineByHintOrVar, containAggOrWindowCheck List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.