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 2022/02/17 11:55:01 UTC

[iotdb] branch fix_field_name created (now b815a34)

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

qiaojialin pushed a change to branch fix_field_name
in repository https://gitbox.apache.org/repos/asf/iotdb.git.


      at b815a34  change prefixPath in Tablet to deviceId

This branch includes the following new commits:

     new b815a34  change prefixPath in Tablet to deviceId

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[iotdb] 01/01: change prefixPath in Tablet to deviceId

Posted by qi...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

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

commit b815a3423c2300f7ef9959232828df993c9e466b
Author: qiaojialin <64...@qq.com>
AuthorDate: Thu Feb 17 19:54:16 2022 +0800

    change prefixPath in Tablet to deviceId
---
 .../java/org/apache/iotdb/session/Session.java     |  8 ++++----
 .../apache/iotdb/tsfile/write/TsFileWriter.java    |  8 ++++----
 .../apache/iotdb/tsfile/write/record/Tablet.java   | 22 +++++++++++-----------
 3 files changed, 19 insertions(+), 19 deletions(-)

diff --git a/session/src/main/java/org/apache/iotdb/session/Session.java b/session/src/main/java/org/apache/iotdb/session/Session.java
index 2c18c2d..38d5ce7 100644
--- a/session/src/main/java/org/apache/iotdb/session/Session.java
+++ b/session/src/main/java/org/apache/iotdb/session/Session.java
@@ -1570,9 +1570,9 @@ public class Session {
       throws IoTDBConnectionException, StatementExecutionException {
     TSInsertTabletReq request = genTSInsertTabletReq(tablet, sorted);
     try {
-      getSessionConnection(tablet.prefixPath).insertTablet(request);
+      getSessionConnection(tablet.deviceId).insertTablet(request);
     } catch (RedirectException e) {
-      handleRedirection(tablet.prefixPath, e.getEndPoint());
+      handleRedirection(tablet.deviceId, e.getEndPoint());
     }
   }
 
@@ -1617,7 +1617,7 @@ public class Session {
       request.addToTypes(measurementSchema.getType().ordinal());
     }
 
-    request.setPrefixPath(tablet.prefixPath);
+    request.setPrefixPath(tablet.deviceId);
     request.setIsAligned(tablet.isAligned());
     request.setTimestamps(SessionUtils.getTimeBuffer(tablet));
     request.setValues(SessionUtils.getValueBuffer(tablet));
@@ -1724,7 +1724,7 @@ public class Session {
     if (!checkSorted(tablet)) {
       sortTablet(tablet);
     }
-    request.addToPrefixPaths(tablet.prefixPath);
+    request.addToPrefixPaths(tablet.deviceId);
     List<String> measurements = new ArrayList<>();
     List<Integer> dataTypes = new ArrayList<>();
 
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/TsFileWriter.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/TsFileWriter.java
index 5c38bab..f2ced03 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/write/TsFileWriter.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/write/TsFileWriter.java
@@ -349,9 +349,9 @@ public class TsFileWriter implements AutoCloseable {
 
   private void checkIsTimeseriesExist(Tablet tablet, boolean isAligned)
       throws WriteProcessException {
-    IChunkGroupWriter groupWriter = tryToInitialGroupWriter(tablet.prefixPath, isAligned);
+    IChunkGroupWriter groupWriter = tryToInitialGroupWriter(tablet.deviceId, isAligned);
 
-    Path devicePath = new Path(tablet.prefixPath);
+    Path devicePath = new Path(tablet.deviceId);
     List<MeasurementSchema> schemas = tablet.getSchemas();
     if (schema.containsDevice(devicePath)) {
       checkIsAllMeasurementsInGroup(schema.getSeriesSchema(devicePath), schemas, isAligned);
@@ -509,7 +509,7 @@ public class TsFileWriter implements AutoCloseable {
     // make sure the ChunkGroupWriter for this Tablet exist
     checkIsTimeseriesExist(tablet, false);
     // get corresponding ChunkGroupWriter and write this Tablet
-    recordCount += groupWriters.get(tablet.prefixPath).write(tablet);
+    recordCount += groupWriters.get(tablet.deviceId).write(tablet);
     return checkMemorySizeAndMayFlushChunks();
   }
 
@@ -517,7 +517,7 @@ public class TsFileWriter implements AutoCloseable {
     // make sure the ChunkGroupWriter for this Tablet exist
     checkIsTimeseriesExist(tablet, true);
     // get corresponding ChunkGroupWriter and write this Tablet
-    recordCount += groupWriters.get(tablet.prefixPath).write(tablet);
+    recordCount += groupWriters.get(tablet.deviceId).write(tablet);
     return checkMemorySizeAndMayFlushChunks();
   }
 
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 d68b53c..81eb55d 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
@@ -45,13 +45,13 @@ public class Tablet {
   private static final String NOT_SUPPORT_DATATYPE = "Data type %s is not supported.";
 
   /** deviceId of this tablet */
-  public String prefixPath;
+  public String deviceId;
 
   /** the list of measurement schemas for creating the tablet */
   private List<MeasurementSchema> schemas;
 
   /** measurementId->indexOf(measurementSchema) */
-  private Map<String, Integer> measurementIndex;
+  private final Map<String, Integer> measurementIndex;
 
   /** timestamps in this tablet */
   public long[] timestamps;
@@ -62,7 +62,7 @@ public class Tablet {
   /** the number of rows to include in this tablet */
   public int rowSize;
   /** the maximum number of rows for this tablet */
-  private int maxRowNumber;
+  private final int maxRowNumber;
   /** whether this tablet store data of aligned timeseries or not */
   private boolean isAligned;
 
@@ -70,25 +70,25 @@ public class Tablet {
    * Return a tablet with default specified row number. This is the standard constructor (all Tablet
    * should be the same size).
    *
-   * @param prefixPath the name of the device specified to be written in
+   * @param deviceId the name of the device specified to be written in
    * @param schemas the list of measurement schemas for creating the tablet, only measurementId and
    *     type take effects
    */
-  public Tablet(String prefixPath, List<MeasurementSchema> schemas) {
-    this(prefixPath, schemas, DEFAULT_SIZE);
+  public Tablet(String deviceId, List<MeasurementSchema> schemas) {
+    this(deviceId, schemas, DEFAULT_SIZE);
   }
 
   /**
    * Return a tablet with the specified number of rows (maxBatchSize). Only call this constructor
    * directly for testing purposes. Tablet should normally always be default size.
    *
-   * @param prefixPath the name of the device specified to be written in
+   * @param deviceId the name of the device specified to be written in
    * @param schemas the list of measurement schemas for creating the row batch, only measurementId
    *     and type take effects
    * @param maxRowNumber the maximum number of rows for this tablet
    */
-  public Tablet(String prefixPath, List<MeasurementSchema> schemas, int maxRowNumber) {
-    this.prefixPath = prefixPath;
+  public Tablet(String deviceId, List<MeasurementSchema> schemas, int maxRowNumber) {
+    this.deviceId = deviceId;
     this.schemas = new ArrayList<>(schemas);
     this.maxRowNumber = maxRowNumber;
     measurementIndex = new HashMap<>();
@@ -110,8 +110,8 @@ public class Tablet {
     reset();
   }
 
-  public void setPrefixPath(String prefixPath) {
-    this.prefixPath = prefixPath;
+  public void setDeviceId(String deviceId) {
+    this.deviceId = deviceId;
   }
 
   public void setSchemas(List<MeasurementSchema> schemas) {