apache / apache/iotdb

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

オープン
#14,149 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Java
スター
6.4k
フォーク
1.2k
平均マージ
1日 23時間
マージ済み PR(30日)
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!

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

Issue の SQL 再現を IoTDB 1.3.3 に対して実行し、2 つのクエリ結果を比較します。CAST 式の処理と FLOAT の比較パスを追跡し、その後 FLOAT から FLOAT へのキャストで値が保持され、期待される 2 行が返されることを確認します。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
java
領域
databases
issue の種類
バグ
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
45/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。