apache / apache/iotdb

[Bug] The CAST operator has a logical error causing precision loss when converting floating-point values.

未关闭
#14,149 2 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Java
星标
6.4k
派生
1.2k
平均合并
1 天 23 小时
30 天内合并 PR
115

描述

### Search before asking

- [X] I searched in the [issues](https://github.com/apache/iotdb/issues) and found nothing similar.

### Version

version 1.3.3 (Build: ad95a7e)

### Describe the bug and provide the minimal reproduce step

```
DROP DATABASE root.db0
CREATE DATABASE root.db0

CREATE TIMESERIES root.db0.t1 WITH datatype=FLOAT compressor=GZIP 'MAX_POINT_NUMBER'='6';
INSERT INTO root.db0(timestamp, t1) VALUES (1643027794590, 0.5522);
INSERT INTO root.db0(timestamp, t1) VALUES (1643027794600, 0.8044);

# query 1
select t1 from root.db0 where t1 <= 0.8044

# query 2
select t1 from root.db0 where cast(t1 as float) <= 0.8044
```

### What did you expect to see?

Query 1 returned result set: 0.5522 and 0.8044

Query 2 returned result set: 0.5522 and 0.8044

### What did you see instead?

Query 1 returned result set: 0.5522 and 0.8044

Query 2 returned result set: 0.5522

### Anything else?

Dear IoTDB team, When using the CAST operator to convert a FLOAT value to FLOAT, the value theoretically should remain unchanged. However, the above test case indicates that a logical error causing precision loss occurs after the CAST conversion.

### Are you willing to submit a PR?

- [ ] I'm willing to submit a PR!

贡献指南

打开贡献指南

调研方向

针对 IoTDB 1.3.3 运行 issue 中的 SQL 复现,并比较两个查询结果。跟踪 CAST 表达式处理和 FLOAT 比较路径,然后验证将 FLOAT 转换为 FLOAT 会保留该值,并且会返回预期的两行。

由索引模型根据 Issue 内容生成。

评估

技术栈
java
领域
databases
Issue 类型
缺陷
难度
4/5
预计耗时
3-5 天
活跃度
停滞
描述清晰度
基本清楚
新手友好度
45/100

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。