You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ja...@apache.org on 2024/08/06 07:47:01 UTC

(iotdb) branch ty/ChangeTsFileVersion created (now 58dc6725cde)

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

jackietien pushed a change to branch ty/ChangeTsFileVersion
in repository https://gitbox.apache.org/repos/asf/iotdb.git


      at 58dc6725cde add assert for MeasurementPath and AlignedPath

This branch includes the following new commits:

     new 58dc6725cde add assert for MeasurementPath and AlignedPath

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: add assert for MeasurementPath and AlignedPath

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

jackietien pushed a commit to branch ty/ChangeTsFileVersion
in repository https://gitbox.apache.org/repos/asf/iotdb.git

commit 58dc6725cde72f35805f82ea687c99140034098c
Author: JackieTien97 <ja...@gmail.com>
AuthorDate: Tue Aug 6 15:45:42 2024 +0800

    add assert for MeasurementPath and AlignedPath
---
 .../queryengine/plan/analyze/TemplatedAnalyze.java |  9 ++------
 .../plan/expression/leaf/TimeSeriesOperand.java    |  5 +----
 .../org/apache/iotdb/commons/path/AlignedPath.java | 24 ++++++++++++++++++++
 .../apache/iotdb/commons/path/MeasurementPath.java | 26 ++++++++++++++++++++++
 pom.xml                                            |  2 +-
 5 files changed, 54 insertions(+), 12 deletions(-)

diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java
index 6014cd572f7..9622d2a6e16 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/TemplatedAnalyze.java
@@ -22,7 +22,6 @@ package org.apache.iotdb.db.queryengine.plan.analyze;
 import org.apache.iotdb.common.rpc.thrift.TTimePartitionSlot;
 import org.apache.iotdb.commons.partition.DataPartition;
 import org.apache.iotdb.commons.partition.DataPartitionQueryParam;
-import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
@@ -130,10 +129,8 @@ public class TemplatedAnalyze {
             paginationController.consumeOffset();
           } else if (paginationController.hasCurLimit()) {
             String measurementName = entry.getKey();
-            IMeasurementSchema measurementSchema = entry.getValue();
             TimeSeriesOperand measurementPath =
-                new TimeSeriesOperand(
-                    new MeasurementPath(new String[] {measurementName}, measurementSchema));
+                new TimeSeriesOperand(new PartialPath(new String[] {measurementName}));
             // reserve memory for this expression
             context.reserveMemoryForFrontEnd(measurementPath.ramBytesUsed());
             outputExpressions.add(new Pair<>(measurementPath, null));
@@ -153,10 +150,8 @@ public class TemplatedAnalyze {
           if (paginationController.hasCurOffset()) {
             paginationController.consumeOffset();
           } else if (paginationController.hasCurLimit()) {
-            IMeasurementSchema measurementSchema = template.getSchemaMap().get(measurementName);
             TimeSeriesOperand measurementPath =
-                new TimeSeriesOperand(
-                    new MeasurementPath(new String[] {measurementName}, measurementSchema));
+                new TimeSeriesOperand(new PartialPath(new String[] {measurementName}));
             // reserve memory for this expression
             context.reserveMemoryForFrontEnd(measurementPath.ramBytesUsed());
             outputExpressions.add(new Pair<>(measurementPath, resultColumn.getAlias()));
diff --git a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/TimeSeriesOperand.java b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/TimeSeriesOperand.java
index 22ded4d95d7..f063605dfa4 100644
--- a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/TimeSeriesOperand.java
+++ b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/expression/leaf/TimeSeriesOperand.java
@@ -19,7 +19,6 @@
 
 package org.apache.iotdb.db.queryengine.plan.expression.leaf;
 
-import org.apache.iotdb.commons.path.MeasurementPath;
 import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathDeserializeUtil;
 import org.apache.iotdb.db.queryengine.execution.MemoryEstimationHelper;
@@ -54,9 +53,7 @@ public class TimeSeriesOperand extends LeafOperand {
 
   public static TimeSeriesOperand constructColumnHeaderExpression(
       String columnName, TSDataType dataType) {
-    MeasurementPath measurementPath =
-        new MeasurementPath(new PartialPath(columnName, false), dataType);
-    return new TimeSeriesOperand(measurementPath);
+    return new TimeSeriesOperand(new PartialPath(columnName, false));
   }
 
   public PartialPath getPath() {
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/AlignedPath.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/AlignedPath.java
index 6bb91921769..150613e066c 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/AlignedPath.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/AlignedPath.java
@@ -52,6 +52,9 @@ import java.util.Objects;
  */
 public class AlignedPath extends PartialPath {
 
+  private static final String NODES_LENGTH_ERROR =
+      "nodes.length for MeasurementPath should always be greater than 1, current is: %s";
+
   private static final Logger logger = LoggerFactory.getLogger(AlignedPath.class);
 
   // todo improve vector implementation by remove this placeholder
@@ -64,6 +67,9 @@ public class AlignedPath extends PartialPath {
 
   public AlignedPath(String vectorPath, List<String> subSensorsList) throws IllegalPathException {
     super(vectorPath);
+    if (nodes.length < 2) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     // check whether subSensor is legal
     for (String subSensor : subSensorsList) {
       PathUtils.isLegalPath(subSensor);
@@ -91,6 +97,9 @@ public class AlignedPath extends PartialPath {
 
   public AlignedPath(String vectorPath, String subSensor) throws IllegalPathException {
     super(vectorPath);
+    if (nodes.length < 2) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     measurementList = new ArrayList<>();
     PathUtils.isLegalPath(subSensor);
     measurementList.add(subSensor);
@@ -98,6 +107,9 @@ public class AlignedPath extends PartialPath {
 
   public AlignedPath(PartialPath vectorPath, String subSensor) throws IllegalPathException {
     super(vectorPath.getNodes());
+    if (nodes.length < 2) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     measurementList = new ArrayList<>();
     PathUtils.isLegalPath(subSensor);
     measurementList.add(subSensor);
@@ -105,12 +117,18 @@ public class AlignedPath extends PartialPath {
 
   public AlignedPath(PartialPath vectorPath) {
     super(vectorPath.getNodes());
+    if (nodes.length < 2) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     measurementList = new ArrayList<>();
     schemaList = new ArrayList<>();
   }
 
   public AlignedPath(MeasurementPath path) {
     super(path.getDevicePath().getNodes());
+    if (nodes.length < 2) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     measurementList = new ArrayList<>();
     measurementList.add(path.getMeasurement());
     schemaList = new ArrayList<>();
@@ -119,6 +137,9 @@ public class AlignedPath extends PartialPath {
 
   public AlignedPath(String vectorPath) throws IllegalPathException {
     super(vectorPath);
+    if (nodes.length < 2) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     measurementList = new ArrayList<>();
     schemaList = new ArrayList<>();
   }
@@ -126,6 +147,9 @@ public class AlignedPath extends PartialPath {
   public AlignedPath(
       String[] nodes, List<String> measurementList, List<IMeasurementSchema> schemaList) {
     super(nodes);
+    if (nodes.length < 2) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     this.measurementList = measurementList;
     this.schemaList = schemaList;
   }
diff --git a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java
index 7a39c955337..535fcd49497 100644
--- a/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java
+++ b/iotdb-core/node-commons/src/main/java/org/apache/iotdb/commons/path/MeasurementPath.java
@@ -49,6 +49,9 @@ import static org.apache.iotdb.commons.conf.IoTDBConstant.MULTI_LEVEL_PATH_WILDC
 
 public class MeasurementPath extends PartialPath {
 
+  private static final String NODES_LENGTH_ERROR =
+      "nodes.length for MeasurementPath should always be greater than 2, current is: %s";
+
   private static final Logger logger = LoggerFactory.getLogger(MeasurementPath.class);
 
   private IMeasurementSchema measurementSchema;
@@ -64,10 +67,16 @@ public class MeasurementPath extends PartialPath {
 
   public MeasurementPath(String measurementPath) throws IllegalPathException {
     super(measurementPath);
+    if (nodes.length < 3) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
   }
 
   public MeasurementPath(String measurementPath, TSDataType type) throws IllegalPathException {
     super(measurementPath);
+    if (nodes.length < 3) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     this.measurementSchema = new MeasurementSchema(getMeasurement(), type);
   }
 
@@ -84,6 +93,9 @@ public class MeasurementPath extends PartialPath {
       IMeasurementSchema measurementSchema,
       Boolean isUnderAlignedEntity) {
     super(measurementPath.getNodes());
+    if (nodes.length < 3) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     this.measurementSchema = measurementSchema;
     this.isUnderAlignedEntity = isUnderAlignedEntity;
   }
@@ -100,21 +112,35 @@ public class MeasurementPath extends PartialPath {
 
   public MeasurementPath(String device, String measurement) throws IllegalPathException {
     super(device, measurement);
+    if (nodes.length < 3) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
   }
 
   public MeasurementPath(String device, String measurement, IMeasurementSchema measurementSchema)
       throws IllegalPathException {
     super(device, measurement);
+    if (nodes.length < 3) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     this.measurementSchema = measurementSchema;
   }
 
   public MeasurementPath(String[] nodes, IMeasurementSchema schema) {
     super(nodes);
+    if (nodes.length < 3) {
+      throw new IllegalArgumentException(String.format(NODES_LENGTH_ERROR, Arrays.toString(nodes)));
+    }
     this.measurementSchema = schema;
   }
 
   public MeasurementPath(String[] nodes) {
     super(nodes);
+    if (nodes.length < 3) {
+      throw new IllegalArgumentException(
+          "nodes.length for MeasurementPath should always be greater than 2, current is: "
+              + Arrays.toString(nodes));
+    }
   }
 
   @Override
diff --git a/pom.xml b/pom.xml
index 58a9047b352..f582154b2ca 100644
--- a/pom.xml
+++ b/pom.xml
@@ -166,7 +166,7 @@
         <thrift.version>0.14.1</thrift.version>
         <xz.version>1.9</xz.version>
         <zstd-jni.version>1.5.6-3</zstd-jni.version>
-        <tsfile.version>1.0.1-tsfilev4-240726-SNAPSHOT</tsfile.version>
+        <tsfile.version>1.2.0-8aaedb22-SNAPSHOT</tsfile.version>
     </properties>
     <!--
     if we claim dependencies in dependencyManagement, then we do not claim