pingcap / pingcap/tidb

After `cot()` is evaluated, the returned result is incorrect

Open
#56,777 12 comments 0 reactions 0 assignees View on GitHub
affects-8.4 affects-8.5 fuzz/comp impact/inconsistency may-affects-5.4 may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 may-affects-8.1 severity/moderate sig/execution type/bug
Dominant language
Go
Stars
40.5k
Forks
6.2k
PR merge metrics
PR metrics pending

Description

## Bug Report

Please answer these questions before submitting your issue. Thanks!

### 1. Minimal reproduce step (Required)

```
create table lrr_test(`COL1` mediumint(45) NOT NULL);
insert into lrr_test values(-2308143);
insert into lrr_test values(90);
select col1, cot(col1) from lrr_test where col1=-2308143;
select col1, cot(col1) from lrr_test where cot(col1)=cot(-2308143);
```

### 2. What did you expect to see? (Required)
+----------+--------------------+
| col1 | cot(col1) |
+----------+--------------------+
| -2308143 | 0.9135308955291633 |
+----------+--------------------+

### 3. What did you see instead (Required)
Empty set
It seems that the judgment failed due to precision problems.
Can execution plan be simplified to judge `col=-2308143`:
![image](https://github.com/user-attachments/assets/04e61574-d395-47ba-a172-21b451349666)

### 4. What is your TiDB version? (Required)

Release Version: v8.4.0
Edition: Community
Git Commit Hash: 2205f332ffcf3553ffc49438cfe1087a0f08dd18
Git Branch: HEAD
UTC Build Time: 2024-10-17 07:36:44
GoVersion: go1.23.2
Race Enabled: false
Check Table Before Drop: false
Store: tikv

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.