Skip to content

Commit 1365d2f

Browse files
committed
Simplify the way of obtaining a measurementPath object.
1 parent 42ea316 commit 1365d2f

File tree

1 file changed

+1
-50
lines changed

1 file changed

+1
-50
lines changed

iotdb-core/confignode/src/test/java/org/apache/iotdb/confignode/procedure/impl/schema/AlterTimeSeriesDataTypeProcedureTest.java

Lines changed: 1 addition & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -21,35 +21,24 @@
2121

2222
import org.apache.iotdb.commons.exception.IllegalPathException;
2323
import org.apache.iotdb.commons.path.MeasurementPath;
24-
import org.apache.iotdb.commons.path.PartialPath;
25-
import org.apache.iotdb.commons.schema.template.Template;
2624
import org.apache.iotdb.commons.schema.tree.AlterTimeSeriesOperationType;
2725
import org.apache.iotdb.confignode.procedure.store.ProcedureType;
28-
import org.apache.iotdb.db.queryengine.common.schematree.ClusterSchemaTree;
29-
import org.apache.iotdb.db.queryengine.plan.relational.metadata.fetcher.cache.TreeDeviceSchemaCacheManager;
30-
import org.apache.iotdb.db.schemaengine.template.ClusterTemplateManager;
3126

3227
import org.apache.tsfile.enums.TSDataType;
33-
import org.apache.tsfile.file.metadata.enums.CompressionType;
34-
import org.apache.tsfile.file.metadata.enums.TSEncoding;
3528
import org.junit.Assert;
3629
import org.junit.Test;
3730

3831
import java.io.ByteArrayOutputStream;
3932
import java.io.DataOutputStream;
4033
import java.io.IOException;
4134
import java.nio.ByteBuffer;
42-
import java.util.Arrays;
43-
import java.util.Collections;
44-
import java.util.List;
4535

4636
public class AlterTimeSeriesDataTypeProcedureTest {
4737

4838
@Test
4939
public void serializeDeserializeTest() throws IllegalPathException, IOException {
5040
String queryId = "1";
51-
52-
MeasurementPath measurementPath = getMeasurementPath();
41+
MeasurementPath measurementPath = new MeasurementPath("root.sg1.d1.s1");
5342
AlterTimeSeriesDataTypeProcedure alterTimeSeriesDataTypeProcedure =
5443
new AlterTimeSeriesDataTypeProcedure(
5544
queryId,
@@ -74,42 +63,4 @@ public void serializeDeserializeTest() throws IllegalPathException, IOException
7463
Assert.assertEquals(queryId, deserializedProcedure.getQueryId());
7564
Assert.assertEquals("root.sg1.d1.s1", deserializedProcedure.getmeasurementPath().getFullPath());
7665
}
77-
78-
private static MeasurementPath getMeasurementPath() throws IllegalPathException {
79-
final ClusterSchemaTree clusterSchemaTree = new ClusterSchemaTree();
80-
final Template template1 =
81-
new Template(
82-
"t1",
83-
Arrays.asList("s1", "s2"),
84-
Arrays.asList(TSDataType.DOUBLE, TSDataType.INT32),
85-
Arrays.asList(TSEncoding.RLE, TSEncoding.RLE),
86-
Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY));
87-
template1.setId(1);
88-
final Template template2 =
89-
new Template(
90-
"t2",
91-
Arrays.asList("t1", "t2", "t3"),
92-
Arrays.asList(TSDataType.DOUBLE, TSDataType.INT32, TSDataType.INT64),
93-
Arrays.asList(TSEncoding.RLE, TSEncoding.RLE, TSEncoding.RLBE),
94-
Arrays.asList(CompressionType.SNAPPY, CompressionType.SNAPPY, CompressionType.SNAPPY));
95-
template2.setId(2);
96-
ClusterTemplateManager.getInstance().putTemplate(template1);
97-
ClusterTemplateManager.getInstance().putTemplate(template2);
98-
clusterSchemaTree.appendTemplateDevice(new PartialPath("root.sg1.d1"), false, 1, template1);
99-
clusterSchemaTree.appendTemplateDevice(new PartialPath("root.sg1.d2"), false, 2, template2);
100-
clusterSchemaTree.setDatabases(Collections.singleton("root.sg1"));
101-
clusterSchemaTree.appendSingleMeasurementPath(
102-
new MeasurementPath("root.sg1.d3.s1", TSDataType.FLOAT));
103-
104-
TreeDeviceSchemaCacheManager treeDeviceSchemaCacheManager =
105-
TreeDeviceSchemaCacheManager.getInstance();
106-
treeDeviceSchemaCacheManager.put(clusterSchemaTree);
107-
final ClusterSchemaTree d1Tree =
108-
treeDeviceSchemaCacheManager.getMatchedTemplateSchema(new PartialPath("root.sg1.d1"));
109-
110-
final String[] ALL_RESULT_NODES = new String[] {"root", "sg1", "**"};
111-
final PartialPath ALL_MATCH_PATTERN = new PartialPath(ALL_RESULT_NODES);
112-
List<MeasurementPath> measurementPaths = d1Tree.searchMeasurementPaths(ALL_MATCH_PATTERN).left;
113-
return measurementPaths.get(0);
114-
}
11566
}

0 commit comments

Comments
 (0)