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

leirui pushed a commit to branch research/M4-visualization
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/research/M4-visualization by 
this push:
     new a39a29bc4c 81%
a39a29bc4c is described below

commit a39a29bc4cf84d0462414bb1ddc99c26bf64213f
Author: Lei Rui <[email protected]>
AuthorDate: Mon Oct 10 17:52:40 2022 +0800

    81%
---
 .../iotdb/session/MyRealDataTest1_WriteAndQuery.java |  2 +-
 .../tsfile/encoding/decoder/DeltaBinaryDecoder.java  | 20 +++++++++-----------
 2 files changed, 10 insertions(+), 12 deletions(-)

diff --git 
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
 
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
index 6024cd118a..10f8235500 100644
--- 
a/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
+++ 
b/session/src/test/java/org/apache/iotdb/session/MyRealDataTest1_WriteAndQuery.java
@@ -73,7 +73,7 @@ public class MyRealDataTest1_WriteAndQuery {
     private static int valueIdx = 1; // 值idx,从0开始
     private static int w = 2;
     private static long range = total_time_length;
-    private static boolean enableRegularityTimeDecode = false;
+    private static boolean enableRegularityTimeDecode = true;
     private static long regularTimeInterval = 511996L;
     private static String approach = "mac"; // 选择查询执行算法: 1: MAC, 2: MOC, 3: CPV
 
diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
index efa704e1b6..a4c382455d 100644
--- 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
+++ 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/encoding/decoder/DeltaBinaryDecoder.java
@@ -185,13 +185,11 @@ public abstract class DeltaBinaryDecoder extends Decoder {
 
     private boolean enableRegularityTimeDecode;
     private long regularTimeInterval;
-    //    private byte[]
-    //        encodedRegularTimeInterval; // it depends on minDeltaBase and 
bitWidth of each pack
 
-    private Map<Pair<Long, Integer>, Map<Integer, byte[]>> allRegularBytes =
+    private Map<Pair<Long, Integer>, byte[][]> allRegularBytes =
         new HashMap<>(); // <newRegularDelta,packWidth> -> (relativePos->bytes)
 
-    private Map<Integer, int[]> allFallWithinMasks = new HashMap<>(); // 
packWidth -> fallWithinMasks
+    private int[][] allFallWithinMasks = new int[7][]; // packWidth(1~7) -> 
fallWithinMasks[]
 
     public LongDeltaDecoder() {
       super();
@@ -258,20 +256,20 @@ public abstract class DeltaBinaryDecoder extends Decoder {
           int[] fallWithinMasks = null;
           if (packWidth >= 8) {
             fallWithinMasks = null;
-          } else if (allFallWithinMasks.containsKey(packWidth)) {
-            fallWithinMasks = allFallWithinMasks.get(packWidth);
+          } else if (allFallWithinMasks[packWidth - 1] != null) { // 
1<=packWidth<=7
+            fallWithinMasks = allFallWithinMasks[packWidth - 1];
           } else { // packWidth<8 and allFallWithinMasks does not contain it
             try {
               fallWithinMasks = 
TsFileConstant.generateFallWithinMasks(packWidth);
-              allFallWithinMasks.put(packWidth, fallWithinMasks);
+              allFallWithinMasks[packWidth - 1] = fallWithinMasks;
             } catch (Exception ignored) {
             }
           }
-          Map<Integer, byte[]> regularBytes;
+          byte[][] regularBytes;
           if (allRegularBytes.containsKey(new Pair<>(newRegularDelta, 
packWidth))) {
             regularBytes = allRegularBytes.get(new Pair<>(newRegularDelta, 
packWidth));
           } else {  // TODO consider if the following steps can be accelerated 
by using bytes instead of bitwise get and set
-            regularBytes = new HashMap<>();
+            regularBytes = new byte[8][]; // 8 relative positions. 
relativePos->bytes
             for (int i = 0; i < 8; i++) {
               // i is the starting position in the byte from high to low bits
 
@@ -310,7 +308,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
                   byteArray[byteNum - 1] = 
BytesUtils.setByteN(byteArray[byteNum - 1], x, value);
                 }
               }
-              regularBytes.put(i, byteArray);
+              regularBytes[i] = byteArray;
             }
             allRegularBytes.put(new Pair<>(newRegularDelta, packWidth), 
regularBytes);
           }
@@ -326,7 +324,7 @@ public abstract class DeltaBinaryDecoder extends Decoder {
             int pos = i * packWidth
                 % 8; // the starting relative position in the byte from high 
to low bits
 
-            byte[] byteArray = regularBytes.get(pos); // the regular padded 
bytes to be compared
+            byte[] byteArray = regularBytes[pos]; // the regular padded bytes 
to be compared
 
             int posByteIdx = i * packWidth / 8; // the start byte of the 
encoded new delta
 

Reply via email to