planner: fix hint doesn't work after inlining CTE
What problem does this PR solve?
Issue Number: close #53454
Problem Summary:
What changed and how does it work?
Check List
Tests
- [x] Unit test
- [ ] Integration test
- [ ] Manual test (add detailed scripts or steps below)
- [ ] No need to test
- [ ] I checked and no code files have been changed.
Side effects
- [ ] Performance regression: Consumes more CPU
- [ ] Performance regression: Consumes more Memory
- [ ] Breaking backward compatibility
Documentation
- [ ] Affects user behaviors
- [ ] Contains syntax changes
- [ ] Contains variable changes
- [ ] Contains experimental features
- [ ] Changes MySQL compatibility
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.
None
Codecov Report
All modified and coverable lines are covered by tests :white_check_mark:
Project coverage is 56.0625%. Comparing base (
2ea3542) to head (9b20e37). Report is 359 commits behind head on master.
Additional details and impacted files
@@ Coverage Diff @@
## master #55653 +/- ##
=================================================
- Coverage 72.8732% 56.0625% -16.8107%
=================================================
Files 1605 1730 +125
Lines 446555 622025 +175470
=================================================
+ Hits 325419 348723 +23304
- Misses 101082 249625 +148543
- Partials 20054 23677 +3623
| Flag | Coverage Δ | |
|---|---|---|
| integration | 37.2583% <100.0000%> (?) |
|
| unit | 72.0072% <100.0000%> (+0.0171%) |
:arrow_up: |
Flags with carried forward coverage won't be shown. Click here to find out more.
| Components | Coverage Δ | |
|---|---|---|
| dumpling | 52.9567% <ø> (ø) |
|
| parser | ∅ <ø> (∅) |
|
| br | 52.8336% <ø> (+7.0793%) |
:arrow_up: |
/retest
[APPROVALNOTIFIER] This PR is APPROVED
This pull-request has been approved by: elsa0520
The full list of commands accepted by this bot can be found here.
The pull request process is described here
- ~~OWNERS~~ [elsa0520]
- ~~pkg/planner/OWNERS~~ [elsa0520]
Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment
[LGTM Timeline notifier]
Timeline:
2024-09-11 05:48:48.615366 +0000 UTC m=+421798.355789940: :ballot_box_with_check: agreed by elsa0520.
mysql> explain with cte as (select a, count(b) from t2 group by a) select /*+ inl_join(`t2`) */ * from t1, cte t2 where t1.a=t2.a;
+------------------------------------+----------+-----------+---------------+---------------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+------------------------------------+----------+-----------+---------------+---------------------------------------------------------------------------------------------+
| Projection_13 | 9990.00 | root | | test.t1.a, test.t1.b, test.t2.a, Column#13 |
| └─HashJoin_46 | 9990.00 | root | | inner join, equal:[eq(test.t1.a, test.t2.a)] |
| ├─HashAgg_71(Build) | 7992.00 | root | | group by:test.t2.a, funcs:count(Column#29)->Column#13, funcs:firstrow(test.t2.a)->test.t2.a |
| │ └─TableReader_72 | 7992.00 | root | | data:HashAgg_64 |
| │ └─HashAgg_64 | 7992.00 | cop[tikv] | | group by:test.t2.a, funcs:count(test.t2.b)->Column#29 |
| │ └─Selection_70 | 9990.00 | cop[tikv] | | not(isnull(test.t2.a)) |
| │ └─TableFullScan_69 | 10000.00 | cop[tikv] | table:t2 | keep order:false, stats:pseudo |
| └─TableReader_60(Probe) | 9990.00 | root | | data:Selection_59 |
| └─Selection_59 | 9990.00 | cop[tikv] | | not(isnull(test.t1.a)) |
| └─TableFullScan_58 | 10000.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
+------------------------------------+----------+-----------+---------------+---------------------------------------------------------------------------------------------+
10 rows in set, 1 warning (0.00 sec)
Alias case still not work as expected.
I also find it cannot work in MySQL.