-
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: tablesample return unodered result with "order by" suffix for partitioned tables #27349
Comments
I don't think this is 'critical' since |
Dumpling heavily relies on |
I will fix this ASAP. Minimal reproducible steps: drop table if exists t;
create table t (a int, b int, unique key idx(a)) partition by range (a) (
partition p0 values less than (0),
partition p1 values less than (10),
partition p2 values less than (30),
partition p3 values less than (maxvalue)
);
insert into t values (2, 2), (31, 31), (12, 12);
select _tidb_rowid from t tablesample regions() order by _tidb_rowid;
+-------------+
| _tidb_rowid |
+-------------+
| 1 |
| 3 |
| 2 |
+-------------+
3 rows in set (0.01 sec) |
The problem is the incorrect assumption about the relationship between the ranges and the handles: The smaller handles always occur in the ranges with a smaller Lines 134 to 144 in 7755d25
However, this is not true in partition tables. Different partitions use different table IDs, a smaller handle may be encoded with a large table ID, resulting in a larger range We need to prevent the physical plan |
Since this will block partition table users using dumpling, I'll change the severity to critical |
Please edit this comment or add a new comment to complete the following informationNot a bug
Duplicate bug
BugNote: Make Sure that 'component', and 'severity' labels are added 1. Root Cause Analysis (RCA) (optional)2. Symptom (optional)3. All Trigger Conditions (optional)4. Workaround (optional)5. Affected versions6. Fixed versions |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
dump the following data to TiDB v5.+
run the following sql:
2. What did you expect to see? (Required)
The result is in order:
3. What did you see instead (Required)
The result is disordered.
4. What is your TiDB version? (Required)
v5.0.0, v5.1.1
The text was updated successfully, but these errors were encountered: