Skip to content

value change caused by DISTINCT #38756

@qaqcatz

Description

@qaqcatz

Bug Report

1. Minimal reproduce step (Required)

drop table if exists t;
create table t (c1 int);
insert into t values (1), (2), (3);

(SELECT SQRT(1) FROM t); -- sql1

(SELECT DISTINCT SQRT(1) FROM t); -- sql2

2. What did you expect to see? (Required)

In theory, the result of sql2(DISTINCT) ⊆ the result of sql1.

3. What did you see instead (Required)

However, the value 1 changed to 5e-324 after adding DISTINCT, seems like a logical bug.

mysql> (SELECT SQRT(1) FROM t); -- sql1
+---------+
| SQRT(1) |
+---------+
|       1 |
|       1 |
|       1 |
+---------+
3 rows in set (0.00 sec)

mysql> (SELECT DISTINCT SQRT(1) FROM t); -- sql2
+---------+
| SQRT(1) |
+---------+
|  5e-324 |
+---------+
1 row in set (0.00 sec)

4. What is your TiDB version? (Required)

Release Version: v6.3.0-alpha-567-g312155afb
Edition: Community
Git Commit Hash: 312155afbd0f91a7526e9b2910cf2beb09bfc6f5
Git Branch: master
UTC Build Time: 2022-10-31 03:20:57
GoVersion: go1.19.1
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: unistore

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions