You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by ha...@apache.org on 2022/09/28 08:12:38 UTC
[iotdb] 01/01: [To rel/0.13][IOTDB-4542] Optimize schema validate error message
This is an automated email from the ASF dual-hosted git repository.
haonan pushed a commit to branch IOTDB-4542-13
in repository https://gitbox.apache.org/repos/asf/iotdb.git
commit c454db8fa4b3489c4c04df18cb85b8c78cd4ff6d
Author: HTHou <hh...@outlook.com>
AuthorDate: Wed Sep 28 16:12:23 2022 +0800
[To rel/0.13][IOTDB-4542] Optimize schema validate error message
---
.../org/apache/iotdb/session/IoTDBSessionSimpleIT.java | 2 +-
.../main/java/org/apache/iotdb/db/metadata/MManager.java | 15 +++++++--------
.../org/apache/iotdb/db/metadata/MManagerBasicTest.java | 4 ++--
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
index af6a32151a..451be54fd7 100644
--- a/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
+++ b/integration/src/test/java/org/apache/iotdb/session/IoTDBSessionSimpleIT.java
@@ -1300,7 +1300,7 @@ public class IoTDBSessionSimpleIT {
session.insertAlignedRecord("root.sg.loc1.sector.GPS", 3L, measurements, values);
} catch (StatementExecutionException e) {
assertEquals(
- "303: Timeseries under path [root.sg.loc1.sector.GPS] is not aligned , please set InsertPlan.isAligned() = false",
+ "319: timeseries under this device are not aligned, please use non-aligned interface (Path: root.sg.loc1.sector.GPS)",
e.getMessage());
}
diff --git a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
index d88dd82879..9be5fc84db 100644
--- a/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
+++ b/server/src/main/java/org/apache/iotdb/db/metadata/MManager.java
@@ -26,6 +26,7 @@ import org.apache.iotdb.db.engine.StorageEngine;
import org.apache.iotdb.db.engine.fileSystem.SystemFileFactory;
import org.apache.iotdb.db.engine.trigger.executor.TriggerEngine;
import org.apache.iotdb.db.exception.metadata.AliasAlreadyExistException;
+import org.apache.iotdb.db.exception.metadata.AlignedTimeseriesException;
import org.apache.iotdb.db.exception.metadata.DataTypeMismatchException;
import org.apache.iotdb.db.exception.metadata.DeleteFailedException;
import org.apache.iotdb.db.exception.metadata.DifferentTemplateException;
@@ -2031,17 +2032,15 @@ public class MManager {
if (deviceMNode.isEntity()) {
if (plan.isAligned()) {
if (!deviceMNode.getAsEntityMNode().isAligned()) {
- throw new MetadataException(
- String.format(
- "Timeseries under path [%s] is not aligned , please set InsertPlan.isAligned() = false",
- plan.getDevicePath()));
+ throw new AlignedTimeseriesException(
+ "timeseries under this device are not aligned, " + "please use non-aligned interface",
+ devicePath.getFullPath());
}
} else {
if (deviceMNode.getAsEntityMNode().isAligned()) {
- throw new MetadataException(
- String.format(
- "Timeseries under path [%s] is aligned , please set InsertPlan.isAligned() = true",
- plan.getDevicePath()));
+ throw new AlignedTimeseriesException(
+ "timeseries under this device are aligned, " + "please use aligned interface",
+ devicePath.getFullPath());
}
}
}
diff --git a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
index 21b1ca63c6..048e070ef3 100644
--- a/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
+++ b/server/src/test/java/org/apache/iotdb/db/metadata/MManagerBasicTest.java
@@ -2060,7 +2060,7 @@ public class MManagerBasicTest {
fail();
} catch (Exception e) {
Assert.assertEquals(
- "Timeseries under path [root.laptop.d1.aligned_device] is aligned , please set InsertPlan.isAligned() = true",
+ "timeseries under this device are aligned, please use aligned interface (Path: root.laptop.d1.aligned_device)",
e.getMessage());
}
}
@@ -2166,7 +2166,7 @@ public class MManagerBasicTest {
fail();
} catch (Exception e) {
Assert.assertEquals(
- "Timeseries under path [root.laptop.d1.aligned_device] is not aligned , please set InsertPlan.isAligned() = false",
+ "timeseries under this device are not aligned, please use non-aligned interface (Path: root.laptop.d1.aligned_device)",
e.getMessage());
}
}