New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
planner: make var_samp
can be used as a window function
#53130
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #53130 +/- ##
================================================
+ Coverage 74.4490% 74.7449% +0.2959%
================================================
Files 1493 1493
Lines 356315 430968 +74653
================================================
+ Hits 265273 322127 +56854
- Misses 71770 89017 +17247
- Partials 19272 19824 +552
Flags with carried forward coverage won't be shown. Click here to find out more.
|
/retest |
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
7e8d2cd
to
09db1b3
Compare
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
Tested locally:
mysql> use test;
msqll> create table t1 (c1 int)
mysql> select c1, var_samp(c1) over (partition by c1) from t1;
Empty set (0.00 sec)
mysql> explain select c1, var_samp(c1) over (partition by c1) from t1;
+-------------------------------+----------+-----------+---------------+-----------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+----------+-----------+---------------+-----------------------------------------------------------------------------------+
| Shuffle_11 | 10000.00 | root | | execution info: concurrency:5, data sources:[TableReader_9] |
| └─Window_7 | 10000.00 | root | | var_samp(cast(test.t1.c1, double BINARY))->Column#4 over(partition by test.t1.c1) |
| └─Sort_10 | 10000.00 | root | | test.t1.c1 |
| └─ShuffleReceiver_12 | 10000.00 | root | | |
| └─TableReader_9 | 10000.00 | root | | data:TableFullScan_8 |
| └─TableFullScan_8 | 10000.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
+-------------------------------+----------+-----------+---------------+-----------------------------------------------------------------------------------+
6 rows in set (0.00 sec)
mysql> explain select c1, sum(c1) over (partition by c1) from t1;
+-------------------------------+----------+-----------+---------------+-------------------------------------------------------------------------------------+
| id | estRows | task | access object | operator info |
+-------------------------------+----------+-----------+---------------+-------------------------------------------------------------------------------------+
| Shuffle_11 | 10000.00 | root | | execution info: concurrency:5, data sources:[TableReader_9] |
| └─Window_7 | 10000.00 | root | | sum(cast(test.t1.c1, decimal(10,0) BINARY))->Column#4 over(partition by test.t1.c1) |
| └─Sort_10 | 10000.00 | root | | test.t1.c1 |
| └─ShuffleReceiver_12 | 10000.00 | root | | |
| └─TableReader_9 | 10000.00 | root | | data:TableFullScan_8 |
| └─TableFullScan_8 | 10000.00 | cop[tikv] | table:t1 | keep order:false, stats:pseudo |
+-------------------------------+----------+-----------+---------------+-------------------------------------------------------------------------------------+
6 rows in set (0.01 sec) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🔢 Self-check (PR reviewed by myself and ready for feedback.)
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: easonn7, qw4990, tangenta, winoros The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
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>
In response to a cherrypick label: new pull request created to branch |
In response to a cherrypick label: new pull request created to branch |
What problem does this PR solve?
Issue Number: close #52933
Problem Summary:
What changed and how does it work?
From the MySQL plan:
var_samp
can be used as a window function.var_samp
as window function cause unexpected error #52933.Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.