-
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
executor: fix wrong result for index merge read generate column #16002
executor: fix wrong result for index merge read generate column #16002
Conversation
@@ -189,6 +189,7 @@ func (e *IndexMergeReaderExecutor) startPartialIndexWorker(ctx context.Context, | |||
SetKeepOrder(false). | |||
SetStreaming(e.partialStreamings[workID]). | |||
SetFromSessionVars(e.ctx.GetSessionVars()). | |||
SetMemTracker(e.memTracker). |
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.
is this a bugfix?
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.
Probably yes. It affects the memory track for index merge reader in the index side.
Codecov Report
@@ Coverage Diff @@
## master #16002 +/- ##
===========================================
Coverage 80.7645% 80.7645%
===========================================
Files 506 506
Lines 138198 138198
===========================================
Hits 111615 111615
Misses 18078 18078
Partials 8505 8505 |
@@ -50,3 +50,14 @@ func (s *testSuite1) TestJoin(c *C) { | |||
tk.MustQuery("select /*+ use_index_merge(t1, t1a, t1b) */ sum(t1.a) from t1 join t2 on t1.id = t2.id where t1.a < 2 or t1.b > 4").Check(testkit.Rows("6")) | |||
tk.MustQuery("select /*+ use_index_merge(t1, t1a, t1b) */ sum(t1.a) from t1 join t2 on t1.id = t2.id where t1.a < 2 or t1.b > 5").Check(testkit.Rows("1")) | |||
} | |||
|
|||
func (s *testSuite1) TestIndexMergeReaderAndGeneratedColumn(c *C) { | |||
tk := testkit.NewTestKitWithInit(c, s.store) |
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.
Do we need to tk.MustExec("set tidb_enable_index_merge=1")
?
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.
No, the hint doesn't require tidb_enable_index_merge
.
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.
ok, but I think it's a bug.
If we do not enable_index_merge, the hint should not take effect
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.
Yes, I think so.
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.
I don't want to interfere, but the documentation currently mentions the following:
IndexMerge is disabled by default. Enable the IndexMerge in one of two ways:
- Set the tidb_enable_index_merge system variable to 1;
- Use the SQL Hint USE_INDEX_MERGE in the query.
Note: The SQL Hint has a higher priority over the system variable.
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.
Alright 😢
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.
LGTM
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.
LGTM
/run-all-tests |
@lzmhhh123 merge failed. |
/merge |
Your auto merge job has been accepted, waiting for 16032, 16338 |
/run-all-tests |
cherry pick to release-4.0 in PR #16359 |
What problem does this PR solve?
Issue Number: close #15994
Problem Summary: When an index merge reader reads the generated column, it gets the wrong result. Because the generated column is ignored in the final table reader stage.
What is changed and how it works?
What's Changed: deal the generated column for final table reader.
Related changes
Check List
Tests
Side effects