ClickHouse / ClickHouse/ClickHouse
Unexpected result when querying a table with a WHERE clause on a Float32 column in SQL
- Dominant language
- C++
- Stars
- 49.9k
- Forks
- 9k
- Avg merge
- 21h 32m
- Merged PRs (30d)
- 515
Description
**Describe what's wrong**
```sql
DROP TABLE IF EXISTS t0;
CREATE TABLE t0 (c0 Int32, c1 Float32) ENGINE = Memory;
INSERT INTO t0 (c0, c1) VALUES (0, 0.9);
SELECT * FROM t0 ;
┌─c0─┬──c1─┐
1. │ 0 │ 0.9 │
└────┴─────┘
1 row in set. Elapsed: 0.001 sec.
```
I ran the above statement and returned the result I expected. c1 is listed as 0.9. But when I put c1=0.9 in the where clause, it doesn't return any value. Whether there is a bug.
```sql
SELECT * FROM t0 WHERE c1 = 0.9;
Ok.
0 rows in set. Elapsed: 0.001 sec.
```
**How to reproduce**
```sql
DROP TABLE IF EXISTS t0;
CREATE TABLE t0 (c0 Int32, c1 Float32) ENGINE = Memory;
INSERT INTO t0 (c0, c1) VALUES (0, 0.9);
SELECT * FROM t0 ;
SELECT * FROM t0 WHERE c1 = 0.9;
```
**Expected behavior**
```sql
SELECT * FROM t0 WHERE c1 = 0.9;
Ok.
┌─c0─┬──c1─┐
1. │ 0 │ 0.9 │
└────┴─────┘
```
**Error message and/or stacktrace**
```sql
SELECT * FROM t0 WHERE c1 = 0.9;
Ok.
0 rows in set. Elapsed: 0.001 sec.
```
Contributor guide
Assessment
This issue has not been assessed yet.