-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
NOT_NULL Flag incorrectly set #18488
Comments
Thank you for the bug report. I can reproduce: mysql> SELECT DISTINCT count(*), id + int_test as res FROM test GROUP BY res ORDER BY res;
+----------+-----+
| count(*) | res |
+----------+-----+
| 1 | NULL |
| 1 | 12 |
+----------+-----+
2 rows in set (0.01 sec) For context, here is the output with column-type-info enabled. In MySQL 8.0: mysql [localhost:8020] {msandbox} (test) > SELECT DISTINCT count(*), id + int_test as res FROM test GROUP BY res ORDER BY res;
Field 1: `count(*)`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: LONGLONG
Collation: binary (63)
Length: 21
Max_length: 1
Decimals: 0
Flags: NOT_NULL NUM
Field 2: `res`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: LONGLONG
Collation: binary (63)
Length: 21
Max_length: 2
Decimals: 0
Flags: NUM
+----------+------+
| count(*) | res |
+----------+------+
| 1 | NULL |
| 1 | 12 |
+----------+------+
2 rows in set (0.00 sec)
In TiDB: mysql> SELECT DISTINCT count(*), id + int_test as res FROM test GROUP BY res ORDER BY res;
Field 1: `count(*)`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: LONGLONG
Collation: binary (63)
Length: 21
Max_length: 1
Decimals: 0
Flags: NOT_NULL BINARY NUM
Field 2: `res`
Catalog: `def`
Database: ``
Table: ``
Org_table: ``
Type: LONGLONG
Collation: binary (63)
Length: 20
Max_length: 2
Decimals: 0
Flags: NOT_NULL BINARY NUM
+----------+-----+
| count(*) | res |
+----------+-----+
| 1 | NULL |
| 1 | 12 |
+----------+-----+
2 rows in set (0.00 sec)
The bug is because TiDB sets the |
/label component/executor |
This is a regression between TiDB 3.1 and 4.0. I can reproduce on 4.0.1, but not on 3.1.2. |
Please check whether the issue should be labeled with 'affects-x.y' or 'backport-x.y.z', |
Bug Report
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
3. What did you see instead (Required)
4. Affected version (Required)
5. Root Cause Analysis
An extra space is printed.
The text was updated successfully, but these errors were encountered: