You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by qi...@apache.org on 2020/06/15 13:17:10 UTC

[incubator-iotdb] branch rel/0.10 updated: [IOTDB-769] [To rel/0.10] fix precision lost when using PLAIN for FLOAT/DOUBLE (#1366)

This is an automated email from the ASF dual-hosted git repository.

qiaojialin pushed a commit to branch rel/0.10
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git


The following commit(s) were added to refs/heads/rel/0.10 by this push:
     new 15a48b0  [IOTDB-769] [To rel/0.10] fix precision lost when using PLAIN for FLOAT/DOUBLE (#1366)
15a48b0 is described below

commit 15a48b0e9bf47bd3e459af456b164182807a4b70
Author: Jialin Qiao <qj...@mails.tsinghua.edu.cn>
AuthorDate: Mon Jun 15 21:17:03 2020 +0800

    [IOTDB-769] [To rel/0.10] fix precision lost when using PLAIN for FLOAT/DOUBLE (#1366)
    
    * fix precision
---
 .../main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java | 2 +-
 .../main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java  | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
index 94f8503..e141b75 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/DoubleTVList.java
@@ -183,7 +183,7 @@ public class DoubleTVList extends TVList {
   protected TimeValuePair getTimeValuePair(int index, long time, Integer floatPrecision,
       TSEncoding encoding) {
     double value = getDouble(index);
-    if (floatPrecision != null && !encoding.equals(TSEncoding.GORILLA)) {
+    if (encoding == TSEncoding.RLE || encoding == TSEncoding.TS_2DIFF) {
       value = MathUtils.roundWithGivenPrecision(value, floatPrecision);
     }
     return new TimeValuePair(time, TsPrimitiveType.getByType(TSDataType.DOUBLE, value));
diff --git a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
index 4518227..178a4f7 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/FloatTVList.java
@@ -183,7 +183,7 @@ public class FloatTVList extends TVList {
   protected TimeValuePair getTimeValuePair(int index, long time, Integer floatPrecision,
       TSEncoding encoding) {
     float value = getFloat(index);
-    if (floatPrecision != null && !encoding.equals(TSEncoding.GORILLA)) {
+    if (encoding == TSEncoding.RLE || encoding == TSEncoding.TS_2DIFF) {
       value = MathUtils.roundWithGivenPrecision(value, floatPrecision);
     }
     return new TimeValuePair(time, TsPrimitiveType.getByType(TSDataType.FLOAT, value));