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

justinchen pushed a commit to branch dev/1.3
in repository https://gitbox.apache.org/repos/asf/iotdb.git


The following commit(s) were added to refs/heads/dev/1.3 by this push:
     new d4fd2ad37cd [To dev/1.3] Ignore device alignment in timeSeries 
auto-creation (#16516) (#16517)
d4fd2ad37cd is described below

commit d4fd2ad37cd767ab0946fc635b155e00f9127624
Author: Caideyipi <[email protected]>
AuthorDate: Mon Sep 29 17:11:13 2025 +0800

    [To dev/1.3] Ignore device alignment in timeSeries auto-creation (#16516) 
(#16517)
---
 .../db/it/schema/IoTDBCreateTimeseriesIT.java      | 12 ++++++++
 .../plan/analyze/schema/NormalSchemaFetcher.java   | 36 ----------------------
 .../mtree/impl/mem/MTreeBelowSGMemoryImpl.java     | 17 ----------
 .../mtree/impl/pbtree/MTreeBelowSGCachedImpl.java  | 17 ----------
 4 files changed, 12 insertions(+), 70 deletions(-)

diff --git 
a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java
 
b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java
index f1af45ffee8..9aa0d0a132b 100644
--- 
a/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java
+++ 
b/integration-test/src/test/java/org/apache/iotdb/db/it/schema/IoTDBCreateTimeseriesIT.java
@@ -300,4 +300,16 @@ public class IoTDBCreateTimeseriesIT extends 
AbstractSchemaIT {
       fail();
     }
   }
+
+  @Test
+  public void testDifferentDeviceAlignment() {
+    try (Connection connection = EnvFactory.getEnv().getConnection();
+        Statement statement = connection.createStatement()) {
+      statement.execute("create timeseries root.sg2.d.s1 with datatype=INT64");
+      // Should ignore the alignment difference
+      statement.execute("create aligned timeseries root.sg2.d (s2 int64, s3 
int64)");
+    } catch (SQLException ignored) {
+      fail();
+    }
+  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java
index 3d05dc95f1e..7607b22dd47 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/queryengine/plan/analyze/schema/NormalSchemaFetcher.java
@@ -24,8 +24,6 @@ import org.apache.iotdb.commons.path.PartialPath;
 import org.apache.iotdb.commons.path.PathPatternTree;
 import org.apache.iotdb.db.conf.IoTDBConfig;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
-import org.apache.iotdb.db.exception.metadata.AlignedTimeseriesException;
-import org.apache.iotdb.db.exception.sql.SemanticException;
 import org.apache.iotdb.db.queryengine.common.MPPQueryContext;
 import org.apache.iotdb.db.queryengine.common.schematree.ClusterSchemaTree;
 import 
org.apache.iotdb.db.queryengine.plan.analyze.cache.schema.DataNodeSchemaCache;
@@ -174,8 +172,6 @@ class NormalSchemaFetcher {
       // Check the isAligned value. If the input value is different from the 
actual value of the
       // existing device, throw exception.
       PartialPath devicePath = 
schemaComputationWithAutoCreation.getDevicePath();
-      validateIsAlignedValueIfAutoCreate(
-          schemaComputationWithAutoCreation.isAligned(), isAlignedPutIn, 
devicePath);
       ClusterSchemaTree schemaTree = new ClusterSchemaTree();
       autoCreateSchemaExecutor.autoCreateTimeSeries(
           schemaTree,
@@ -328,13 +324,6 @@ class NormalSchemaFetcher {
           schemaComputationWithAutoCreationList.stream()
               .map(ISchemaComputationWithAutoCreation::getDevicePath)
               .collect(Collectors.toList());
-      List<Boolean> isAlignedRealList =
-          schemaComputationWithAutoCreationList.stream()
-              .map(ISchemaComputationWithAutoCreation::isAligned)
-              .collect(Collectors.toList());
-      // Check the isAligned value. If the input value is different from the 
actual value of the
-      // existing device, throw exception.
-      validateIsAlignedValueIfAutoCreate(isAlignedRealList, 
isAlignedPutInList, devicePathList);
 
       ClusterSchemaTree schemaTree = new ClusterSchemaTree();
       autoCreateSchemaExecutor.autoCreateTimeSeries(
@@ -389,29 +378,4 @@ class NormalSchemaFetcher {
       }
     }
   }
-
-  private void validateIsAlignedValueIfAutoCreate(
-      List<Boolean> realValueList, List<Boolean> putInValueList, 
List<PartialPath> devicePathList) {
-    int checkLen =
-        Math.min(Math.min(realValueList.size(), putInValueList.size()), 
devicePathList.size());
-    for (int i = 0; i < checkLen; i++) {
-      validateIsAlignedValueIfAutoCreate(
-          realValueList.get(i), putInValueList.get(i), devicePathList.get(i));
-    }
-  }
-
-  private void validateIsAlignedValueIfAutoCreate(
-      boolean realValue, boolean putInValue, PartialPath devicePath) {
-    if (realValue != putInValue) {
-      String msg;
-      if (realValue) {
-        msg =
-            "Timeseries under this device is aligned, please use 
createTimeseries or change device.";
-      } else {
-        msg =
-            "Timeseries under this device is not aligned, please use 
createTimeseries or change device.";
-      }
-      throw new SemanticException(new AlignedTimeseriesException(msg, 
devicePath.getFullPath()));
-    }
-  }
 }
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
index 60e7f99f74f..f8d2bd2316a 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/mem/MTreeBelowSGMemoryImpl.java
@@ -33,7 +33,6 @@ import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.conf.IoTDBDescriptor;
 import org.apache.iotdb.db.exception.metadata.AliasAlreadyExistException;
-import org.apache.iotdb.db.exception.metadata.AlignedTimeseriesException;
 import org.apache.iotdb.db.exception.metadata.MNodeTypeMismatchException;
 import org.apache.iotdb.db.exception.metadata.MeasurementAlreadyExistException;
 import org.apache.iotdb.db.exception.metadata.MeasurementInBlackListException;
@@ -254,14 +253,6 @@ public class MTreeBelowSGMemoryImpl {
         }
       }
 
-      if (device.isDevice()
-          && device.getAsDeviceMNode().isAlignedNullable() != null
-          && device.getAsDeviceMNode().isAligned()) {
-        throw new AlignedTimeseriesException(
-            "time series under this device is aligned, please use 
createAlignedTimeseries or change device.",
-            device.getFullPath());
-      }
-
       final IDeviceMNode<IMemMNode> entityMNode;
       if (device.isDevice()) {
         entityMNode = device.getAsDeviceMNode();
@@ -347,14 +338,6 @@ public class MTreeBelowSGMemoryImpl {
         }
       }
 
-      if (device.isDevice()
-          && device.getAsDeviceMNode().isAlignedNullable() != null
-          && !device.getAsDeviceMNode().isAligned()) {
-        throw new AlignedTimeseriesException(
-            "Time series under this device is not aligned, please use 
createTimeSeries or change device.",
-            devicePath.getFullPath());
-      }
-
       final IDeviceMNode<IMemMNode> entityMNode;
       if (device.isDevice()) {
         entityMNode = device.getAsDeviceMNode();
diff --git 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
index 192e1209f10..e00835cff03 100644
--- 
a/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
+++ 
b/iotdb-core/datanode/src/main/java/org/apache/iotdb/db/schemaengine/schemaregion/mtree/impl/pbtree/MTreeBelowSGCachedImpl.java
@@ -32,7 +32,6 @@ import 
org.apache.iotdb.commons.schema.node.utils.IMNodeIterator;
 import org.apache.iotdb.commons.schema.view.LogicalViewSchema;
 import org.apache.iotdb.commons.schema.view.viewExpression.ViewExpression;
 import org.apache.iotdb.db.exception.metadata.AliasAlreadyExistException;
-import org.apache.iotdb.db.exception.metadata.AlignedTimeseriesException;
 import org.apache.iotdb.db.exception.metadata.MNodeTypeMismatchException;
 import org.apache.iotdb.db.exception.metadata.MeasurementAlreadyExistException;
 import org.apache.iotdb.db.exception.metadata.MeasurementInBlackListException;
@@ -332,14 +331,6 @@ public class MTreeBelowSGCachedImpl {
             }
           }
 
-          if (device.isDevice()
-              && device.getAsDeviceMNode().isAlignedNullable() != null
-              && device.getAsDeviceMNode().isAligned()) {
-            throw new AlignedTimeseriesException(
-                "Time series under this device is aligned, please use 
createAlignedTimeSeries or change device.",
-                device.getFullPath());
-          }
-
           final IDeviceMNode<ICachedMNode> entityMNode;
           if (device.isDevice()) {
             entityMNode = device.getAsDeviceMNode();
@@ -438,14 +429,6 @@ public class MTreeBelowSGCachedImpl {
             }
           }
 
-          if (device.isDevice()
-              && device.getAsDeviceMNode().isAlignedNullable() != null
-              && !device.getAsDeviceMNode().isAligned()) {
-            throw new AlignedTimeseriesException(
-                "TimeSeries under this device is not aligned, please use 
createTimeSeries or change device.",
-                devicePath.getFullPath());
-          }
-
           final IDeviceMNode<ICachedMNode> entityMNode;
           if (device.isDevice()) {
             entityMNode = device.getAsDeviceMNode();

Reply via email to