-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
statistics: fix Clone method to include checked field in ColAndIdxExistenceMap #60171
Conversation
…stenceMap Signed-off-by: Rustin170506 <[email protected]>
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #60171 +/- ##
================================================
+ Coverage 73.1557% 73.8824% +0.7266%
================================================
Files 1708 1738 +30
Lines 471636 480570 +8934
================================================
+ Hits 345029 355057 +10028
+ Misses 105420 103596 -1824
- Partials 21187 21917 +730
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
/retest |
…pdate shard_count Signed-off-by: Rustin170506 <[email protected]>
Signed-off-by: Rustin170506 <[email protected]>
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.)
Tested locally:
USE test;
CREATE TABLE t1 (a INT, b INT, c INT);
CREATE TABLE t2 (a INT, b INT, c INT);
CREATE TABLE t3 (a INT, b INT, c INT);
CREATE TABLE t4 (a INT, b INT, c INT);
INSERT INTO t1 VALUES (1,3,0), (2,2,0), (3,2,0);
INSERT INTO t2 VALUES (3,3,0), (4,2,0), (5,3,0);
INSERT INTO t3 VALUES (1,2,0), (2,2,0);
INSERT INTO t4 VALUES (3,2,0), (4,2,0);
-- Wait for stats to be fully loaded
SHOW STATS_META;
CREATE INDEX idx_b ON t2(b);
SELECT t2.a, t2.b, t3.a, t3.b, t4.a, t4.b
FROM (t3, t4)
LEFT JOIN
(t1, t2)
ON t3.a = 1 AND t3.b = t2.b AND t2.b = t4.b
ORDER BY 1, 2, 3, 4, 5;
USE test;
SELECT t2.a, t2.b, t3.a, t3.b, t4.a, t4.b
FROM (t3, t4)
LEFT JOIN
(t1, t2)
ON t3.a = 1 AND t3.b = t2.b AND t2.b = t4.b
ORDER BY 1, 2, 3, 4, 5;
|
/retest |
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.
Pull Request Overview
This pull request fixes the Clone method in the ColAndIdxExistenceMap by including the checked field, which prevents the sync load from attempting to load stats for a non-existent index.
- Added a test in table_test.go to validate the complete cloning behavior.
- Updated the Clone method in table.go to copy the checked field along with the analyzed maps.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
File | Description |
---|---|
pkg/statistics/table.go | Clone method now includes the checked field |
pkg/statistics/table_test.go | Added test to validate Clone method copying all fields |
Files not reviewed (1)
- pkg/statistics/BUILD.bazel: Language not supported
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hawkingrei, lance6716 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 |
[LGTM Timeline notifier]Timeline:
|
/retest |
What problem does this PR solve?
Issue Number: close #60104
Problem Summary:
What changed and how does it work?
We should also clone the checked field. Otherwise, the sync load will mistakenly attempt to load the stats of a non-existent index.
Note: This bug only occurs when there are no further writes to the table. Otherwise, the stats item is correctly updated as checked, preventing this issue from happening.
Check List
Tests
Side effects
Documentation
Release note
Please refer to Release Notes Language Style Guide to write a quality release note.