-
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
select distinct
produces unexpected result
#53726
Comments
This reproduction has some randomness. Here's what I found. If you execute the following statements real quick (e.g. you can execute them all at once using single statement or using scripts):
You get the wrong result. However if you execute the query again a while later, you get the right result:
|
Now let's capture the plan for the wrong result:
This part Meanwhile the correct plan:
|
I have another question, maybe unrelated to this bug, about the correct plan. Why is this projection |
I am investigating this problem. I find that if we rewrite the SQL, it will get more simple planner.
|
I have fixed it in the #54163. Some same projections forget to merge. |
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The two columns should be same, in MySQL:
3. What did you see instead (Required)
But TiDB outputs strange number.
After removing
distinct
, the result is correct:4. What is your TiDB version? (Required)
topology:
distributed.yaml:
about us
We are the BASS team from the School of Cyber Science and Technology at Beihang University. Our main focus is on system software security, operating systems, and program analysis research, as well as the development of automated program testing frameworks for detecting software defects. Using our self-developed database vulnerability testing tool, we have identified the above-mentioned vulnerabilities in TiDB that may lead to database logic error.
The text was updated successfully, but these errors were encountered: