This is an automated email from the ASF dual-hosted git repository.
haonan 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 7cb2d3f6cf [IOTDB-3168] Fix the path with * could be executed
successfully when inserting in version 14. (#6158)
7cb2d3f6cf is described below
commit 7cb2d3f6cfd79b6353ba2093641826f529e70569
Author: 23931017wu <[email protected]>
AuthorDate: Tue Jun 7 10:37:21 2022 +0800
[IOTDB-3168] Fix the path with * could be executed successfully when
inserting in version 14. (#6158)
---
.../test/java/org/apache/iotdb/db/integration/IOTDBInsertIT.java | 6 ++++++
.../org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java | 1 +
.../org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java | 1 +
.../java/org/apache/iotdb/db/metadata/utils/MetaFormatUtils.java | 6 ++++--
4 files changed, 12 insertions(+), 2 deletions(-)
diff --git
a/integration/src/test/java/org/apache/iotdb/db/integration/IOTDBInsertIT.java
b/integration/src/test/java/org/apache/iotdb/db/integration/IOTDBInsertIT.java
index 9d26d4bfe9..bc86a95a40 100644
---
a/integration/src/test/java/org/apache/iotdb/db/integration/IOTDBInsertIT.java
+++
b/integration/src/test/java/org/apache/iotdb/db/integration/IOTDBInsertIT.java
@@ -157,6 +157,12 @@ public class IOTDBInsertIT {
st1.execute("insert into root.t1.wf01.wt01(status, temperature)
values(true, 20.1, false)");
}
+ @Test(expected = Exception.class)
+ public void testInsertWithException6() throws SQLException {
+ Statement st1 = connection.createStatement();
+ st1.execute(" insert into root.t1.*.a(timestamp, b) values(1509465600000,
true)");
+ }
+
@Test
public void testInsertWithDuplicatedMeasurements() {
try (Statement st1 = connection.createStatement()) {
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
index 8795aabbe6..87773a7f3d 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGCachedImpl.java
@@ -457,6 +457,7 @@ public class MTreeBelowSGCachedImpl implements
IMTreeBelowSG {
@Override
public IMNode getDeviceNodeWithAutoCreating(PartialPath deviceId) throws
MetadataException {
String[] nodeNames = deviceId.getNodes();
+ MetaFormatUtils.checkTimeseries(deviceId);
IMNode cur = storageGroupMNode;
IMNode child;
Template upperTemplate = cur.getSchemaTemplate();
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
index b3dc1b18da..7732cc5dbc 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/mtree/MTreeBelowSGMemoryImpl.java
@@ -412,6 +412,7 @@ public class MTreeBelowSGMemoryImpl implements
IMTreeBelowSG {
*/
@Override
public IMNode getDeviceNodeWithAutoCreating(PartialPath deviceId) throws
MetadataException {
+ MetaFormatUtils.checkTimeseries(deviceId);
String[] nodeNames = deviceId.getNodes();
IMNode cur = storageGroupMNode;
IMNode child;
diff --git
a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaFormatUtils.java
b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaFormatUtils.java
index a4dd32e106..4091b94be4 100644
---
a/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaFormatUtils.java
+++
b/server/src/main/java/org/apache/iotdb/db/metadata/utils/MetaFormatUtils.java
@@ -52,6 +52,7 @@ public class MetaFormatUtils {
}
for (String name : timeseries.getNodes()) {
try {
+ checkNameFormat(name);
checkReservedNames(name);
} catch (MetadataException e) {
throw new IllegalPathException(timeseries.getFullPath(),
e.getMessage());
@@ -59,9 +60,10 @@ public class MetaFormatUtils {
}
}
- /** check whether the node name uses "." correctly */
+ /** check whether the node name uses "." or "*" correctly */
private static void checkNameFormat(String name) throws MetadataException {
- if (!((name.startsWith("`") && name.endsWith("`"))) && name.contains("."))
{
+ if (!((name.startsWith("`") && name.endsWith("`")))
+ && (name.contains(".") || name.contains("*"))) {
throw new MetadataException(String.format("%s is an illegal name.",
name));
}
}