File tree Expand file tree Collapse file tree 2 files changed +32
-1
lines changed
main/java/org/apache/iotdb/db/metadata/mtree
test/java/org/apache/iotdb/db/metadata Expand file tree Collapse file tree 2 files changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -738,8 +738,9 @@ public boolean isPathExist(PartialPath path) {
738738 return false ;
739739 }
740740 cur = upperTemplate .getDirectNode (nodeNames [i ]);
741+ } else {
742+ cur = cur .getChild (nodeNames [i ]);
741743 }
742- cur = cur .getChild (nodeNames [i ]);
743744 if (cur .isMeasurement ()) {
744745 return i == nodeNames .length - 1 ;
745746 }
Original file line number Diff line number Diff line change @@ -254,6 +254,36 @@ public void testAddPathAndExist() throws IllegalPathException {
254254 fail (e .getMessage ());
255255 }
256256 assertFalse (manager .isPathExist (new PartialPath ("root.1" )));
257+
258+ assertFalse (manager .isPathExist (new PartialPath ("root.template" )));
259+ assertFalse (manager .isPathExist (new PartialPath ("root.template.d1" )));
260+
261+ try {
262+ manager .createTimeseries (
263+ new PartialPath ("root.template.d2" ),
264+ TSDataType .INT32 ,
265+ TSEncoding .RLE ,
266+ TSFileDescriptor .getInstance ().getConfig ().getCompressor (),
267+ Collections .emptyMap ());
268+ } catch (MetadataException e ) {
269+ e .printStackTrace ();
270+ fail (e .getMessage ());
271+ }
272+
273+ try {
274+ manager .createSchemaTemplate (getCreateTemplatePlan ());
275+ manager .setSchemaTemplate (new SetTemplatePlan ("template1" , "root.template" ));
276+ manager .setUsingSchemaTemplate (new ActivateTemplatePlan (new PartialPath ("root.template.d1" )));
277+ } catch (MetadataException e ) {
278+ e .printStackTrace ();
279+ fail (e .getMessage ());
280+ }
281+
282+ assertTrue (manager .isPathExist (new PartialPath ("root.template.d1" )));
283+ assertTrue (manager .isPathExist (new PartialPath ("root.template.d1.s11" )));
284+ assertFalse (manager .isPathExist (new PartialPath ("root.template.d2.s11" )));
285+ assertTrue (manager .isPathExist (new PartialPath ("root.template.d1.vector" )));
286+ assertTrue (manager .isPathExist (new PartialPath ("root.template.d1.vector.s0" )));
257287 }
258288
259289 /**
You can’t perform that action at this time.
0 commit comments