You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ju...@apache.org on 2025/09/29 09:10:53 UTC
(iotdb) branch master updated: Ignore device alignment in timeSeries auto-creation (#16516)
This is an automated email from the ASF dual-hosted git repository.
justinchen pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/iotdb.git
The following commit(s) were added to refs/heads/master by this push:
new 8ec5aace9c8 Ignore device alignment in timeSeries auto-creation (#16516)
8ec5aace9c8 is described below
commit 8ec5aace9c8c45d23c4f3eea38e33d26b49a3802
Author: Caideyipi <87...@users.noreply.github.com>
AuthorDate: Mon Sep 29 17:10:47 2025 +0800
Ignore device alignment in timeSeries auto-creation (#16516)
---
.../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 91695afdecd..ca309274b63 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 bb63386ea49..59bb199acf0 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
@@ -26,8 +26,6 @@ import org.apache.iotdb.commons.path.PathPatternTree;
import org.apache.iotdb.commons.pipe.config.constant.SystemConstant;
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.relational.metadata.fetcher.cache.TreeDeviceSchemaCacheManager;
@@ -182,8 +180,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,
@@ -351,13 +347,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(
@@ -414,29 +403,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 605dd3b7a28..387d8c66431 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
@@ -34,7 +34,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;
@@ -280,14 +279,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();
@@ -374,14 +365,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 b6b1a0777be..d5187e14c91 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
@@ -33,7 +33,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;
@@ -334,14 +333,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();
@@ -440,14 +431,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();