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

haonan pushed a commit to branch VectorCodeSmell
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit d3ff7c118a974fb61cd6833a3902e6cef4677f50
Author: HTHou <[email protected]>
AuthorDate: Mon Apr 12 16:46:57 2021 +0800

    [To Vector] Fix Vector Code Smell Step 3
---
 .../iotdb/db/rescon/PrimitiveArrayManager.java     |  2 +-
 .../apache/iotdb/db/rescon/TVListAllocator.java    |  4 +--
 .../db/tools/upgrade/TsFileOnlineUpgradeTool.java  |  7 +-----
 .../iotdb/db/utils/datastructure/TVList.java       |  2 +-
 .../iotdb/db/utils/datastructure/VectorTVList.java | 29 +++++++++++-----------
 .../apache/iotdb/tsfile/utils/TsPrimitiveType.java |  3 ++-
 .../apache/iotdb/tsfile/write/record/Tablet.java   |  2 +-
 7 files changed, 23 insertions(+), 26 deletions(-)

diff --git 
a/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java 
b/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java
index 5924bd7..c0acf62 100644
--- a/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/rescon/PrimitiveArrayManager.java
@@ -37,7 +37,7 @@ import java.util.concurrent.atomic.AtomicLong;
 /** Manage all primitive data list in memory, including get and release 
operation. */
 public class PrimitiveArrayManager {
 
-  /** data type -> ArrayDeque\<Array\> */
+  /** data type -> ArrayDeque of primitive arrays. */
   private static final Map<TSDataType, ArrayDeque<Object>> bufferedArraysMap =
       new EnumMap<>(TSDataType.class);
 
diff --git 
a/server/src/main/java/org/apache/iotdb/db/rescon/TVListAllocator.java 
b/server/src/main/java/org/apache/iotdb/db/rescon/TVListAllocator.java
index d18b98d..b90c33e 100644
--- a/server/src/main/java/org/apache/iotdb/db/rescon/TVListAllocator.java
+++ b/server/src/main/java/org/apache/iotdb/db/rescon/TVListAllocator.java
@@ -56,7 +56,7 @@ public class TVListAllocator implements TVListAllocatorMBean, 
IService {
     return TVList.newVectorList(dataTypes);
   }
 
-  /** For non-vector types */
+  /** For non-vector types. */
   public synchronized void release(TSDataType dataType, TVList list) {
     list.clear();
     if (dataType != TSDataType.VECTOR) {
@@ -64,7 +64,7 @@ public class TVListAllocator implements TVListAllocatorMBean, 
IService {
     }
   }
 
-  /** For VECTOR type only */
+  /** For VECTOR type only. */
   public synchronized void release(TVList list) {
     list.clear();
     if (list.getDataType() != TSDataType.VECTOR) {
diff --git 
a/server/src/main/java/org/apache/iotdb/db/tools/upgrade/TsFileOnlineUpgradeTool.java
 
b/server/src/main/java/org/apache/iotdb/db/tools/upgrade/TsFileOnlineUpgradeTool.java
index afe6bfc..5751218 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/tools/upgrade/TsFileOnlineUpgradeTool.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/tools/upgrade/TsFileOnlineUpgradeTool.java
@@ -80,12 +80,7 @@ public class TsFileOnlineUpgradeTool extends 
TsFileRewriteTool {
     }
   }
 
-  /**
-   * upgrade file resource
-   *
-   * @throws IOException
-   * @throws WriteProcessException
-   */
+  /** upgrade file resource */
   @SuppressWarnings({"squid:S3776", "deprecation"}) // Suppress high Cognitive 
Complexity warning
   private void upgradeFile(List<TsFileResource> upgradedResources)
       throws IOException, WriteProcessException {
diff --git 
a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java 
b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
index 396146f..1592141 100644
--- a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
+++ b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/TVList.java
@@ -94,7 +94,7 @@ public abstract class TVList {
   }
 
   /**
-   * For Vector data type
+   * For Vector data type.
    *
    * @param types the types in the vector
    * @return VectorTvListArrayMemSize
diff --git 
a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/VectorTVList.java
 
b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/VectorTVList.java
index dfe599d..2a8b08e 100644
--- 
a/server/src/main/java/org/apache/iotdb/db/utils/datastructure/VectorTVList.java
+++ 
b/server/src/main/java/org/apache/iotdb/db/utils/datastructure/VectorTVList.java
@@ -189,17 +189,17 @@ public class VectorTVList extends TVList {
         bitMaps.set(columns.indexOf(column), this.bitMaps.get(column));
       }
     }
-    VectorTVList vectorTVList = new VectorTVList(types);
-    vectorTVList.timestamps = this.timestamps;
-    vectorTVList.indices = this.indices;
-    vectorTVList.values = values;
-    vectorTVList.bitMaps = bitMaps;
-    vectorTVList.size = this.size;
-    return vectorTVList;
+    VectorTVList vectorTvList = new VectorTVList(types);
+    vectorTvList.timestamps = this.timestamps;
+    vectorTvList.indices = this.indices;
+    vectorTvList.values = values;
+    vectorTvList.bitMaps = bitMaps;
+    vectorTvList.size = this.size;
+    return vectorTvList;
   }
 
   /**
-   * Get the int value at this position in VectorTvList
+   * Get the int value at the given position in VectorTvList.
    *
    * @param rowIndex value index inside this column
    * @param columnIndex index of the column
@@ -213,7 +213,7 @@ public class VectorTVList extends TVList {
   }
 
   /**
-   * Get the long value at this position in VectorTvList
+   * Get the long value at the given position in VectorTvList.
    *
    * @param rowIndex value index inside this column
    * @param columnIndex index of the column
@@ -227,7 +227,7 @@ public class VectorTVList extends TVList {
   }
 
   /**
-   * Get the float value at this position in VectorTvList
+   * Get the float value at the given position in VectorTvList.
    *
    * @param rowIndex value index inside this column
    * @param columnIndex index of the column
@@ -241,7 +241,7 @@ public class VectorTVList extends TVList {
   }
 
   /**
-   * Get the double value at this position in VectorTvList
+   * Get the double value at the given position in VectorTvList.
    *
    * @param rowIndex value index inside this column
    * @param columnIndex index of the column
@@ -255,7 +255,7 @@ public class VectorTVList extends TVList {
   }
 
   /**
-   * Get the Binary value at this position in VectorTvList
+   * Get the Binary value at the given position in VectorTvList.
    *
    * @param rowIndex value index inside this column
    * @param columnIndex index of the column
@@ -269,7 +269,7 @@ public class VectorTVList extends TVList {
   }
 
   /**
-   * Get the boolean value at this position in VectorTvList
+   * Get the boolean value at the given position in VectorTvList.
    *
    * @param rowIndex value index inside this column
    * @param columnIndex index of the column
@@ -283,7 +283,7 @@ public class VectorTVList extends TVList {
   }
 
   /**
-   * Get whether value is marked at this position in VectorTvList
+   * Get whether value is marked at the given position in VectorTvList.
    *
    * @param rowIndex value index inside this column
    * @param columnIndex index of the column
@@ -497,6 +497,7 @@ public class VectorTVList extends TVList {
     pivotIndex = getValueIndex(pos);
   }
 
+  /* Get the row index value in index column. */
   public int getValueIndex(int index) {
     if (index >= size) {
       throw new ArrayIndexOutOfBoundsException(index);
diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/TsPrimitiveType.java 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/TsPrimitiveType.java
index 81249b3..7bfd218 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/TsPrimitiveType.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/utils/TsPrimitiveType.java
@@ -22,6 +22,7 @@ import 
org.apache.iotdb.tsfile.exception.write.UnSupportedDataTypeException;
 import org.apache.iotdb.tsfile.file.metadata.enums.TSDataType;
 
 import java.io.Serializable;
+import java.util.Arrays;
 
 public abstract class TsPrimitiveType implements Serializable {
 
@@ -526,7 +527,7 @@ public abstract class TsPrimitiveType implements 
Serializable {
 
     @Override
     public int hashCode() {
-      return values.hashCode();
+      return Arrays.hashCode(values);
     }
 
     @Override
diff --git 
a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java 
b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
index bfd0c6f..6cdef69 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/record/Tablet.java
@@ -59,7 +59,7 @@ public class Tablet {
   public long[] timestamps;
   /** each object is a primitive type array, which represents values of one 
measurement */
   public Object[] values;
-  /** each bitmap represents the existence of each value in the current column 
*/
+  /** each bitmap represents the existence of each value in the current 
column. */
   public BitMap[] bitMaps;
   /** the number of rows to include in this tablet */
   public int rowSize;

Reply via email to