cockroachdb / cockroachdb/cockroach
a single float8 constant was parsered to different float value in a single query
- Dominant language
- Go
- Stars
- 32.5k
- Forks
- 4.1k
- PR merge metrics
- PR metrics pending
Description
**Describe the problem**
Please describe the issue you observed, and any steps we can take to reproduce it:
The last `EXECUTE` statement returns two different float values, but the equivalent `SELECT` query only returns one row. if I remove the `GROUP BY`, then the `EXECUTE` statement returns one row
```
CREATE TABLE t1 (c0 FLOAT UNIQUE , c1 FLOAT);
INSERT INTO t1 (c1) VALUES(0.22602838822570093);
UPSERT INTO t1 (rowid, c1) VALUES(1283693985, 0.116859849449506);
INSERT INTO t1 (c1) VALUES(0.6838727571067713), (0.20784120532437889);
UPSERT INTO t1 (c1) VALUES(0.5282973490828922);
INSERT INTO t1 (c1) VALUES(0.20784120532437889);
INSERT INTO t1 (c1, c0, rowid) VALUES(0.9830883959498111, 0.9983111979135002, -1085919062);
SELECT DISTINCT AVG(0.5807336433647674) FROM t1 GROUP BY t1.c0;
PREPARE prepare_query (float8) AS SELECT DISTINCT AVG($1) FROM t1 GROUP BY t1.c0;
EXECUTE prepare_query(0.5807336433647674);
```
**To Reproduce**
What did you do? Describe in your own words.
this is the output:
```
> SELECT DISTINCT AVG(0.5807336433647674) FROM t1 GROUP BY t1.c0;
avg
--------------------------
0.58073364336476740000
(1 row)
Time: 0ms
> PREPARE prepare_query (float8) AS SELECT DISTINCT AVG($1) FROM t1 GROUP BY t1.c0;
PREPARE
Time: 0ms
> EXECUTE prepare_query(0.5807336433647674);
avg
----------------------
0.5807336433647673
0.5807336433647674
(2 rows)
Time: 0ms
```
**Expected behavior**
A clear and concise description of what you expected to happen.
the `EXECUTE` statement only returns one row.
**Additional data / screenshots**
If the problem is SQL-related, include a copy of the SQL query and the schema
of the supporting tables.
If a node in your cluster encountered a fatal error, supply the contents of the
log directories (at minimum of the affected node(s), but preferably all nodes).
Note that log files can contain confidential information. Please continue
creating this issue, but contact support@cockroachlabs.com to submit the log
files in private.
If applicable, add screenshots to help explain your problem.
**Environment:**
- CockroachDB version [25.2.2]
- Server OS: [Linux]
- Client app [`cockroach sql`, JDBC]
**Additional context**
What was the impact?
Add any other context about the problem here.
Jira issue: CRDB-52216
Contributor guide
Assessment
This issue has not been assessed yet.