You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@iotdb.apache.org by su...@apache.org on 2019/10/24 06:37:13 UTC
[incubator-iotdb] 01/01: update error info of querying non-existent
path
This is an automated email from the ASF dual-hosted git repository.
suyue pushed a commit to branch query_non_exist_path_exception
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
commit 05b49cc4a545c33bcc5c320339cffa96e0ca5d36
Author: suyue <23...@qq.com>
AuthorDate: Thu Oct 24 14:36:17 2019 +0800
update error info of querying non-existent path
---
.../iotdb/tsfile/file/metadata/TsFileMetaData.java | 5 ++++-
.../apache/iotdb/tsfile/read/ReadOnlyTsFileTest.java | 17 ++++++++++++++++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
index 04d58d5..eb5fb76 100644
--- a/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
+++ b/tsfile/src/main/java/org/apache/iotdb/tsfile/file/metadata/TsFileMetaData.java
@@ -192,7 +192,10 @@ public class TsFileMetaData {
return this.deviceIndexMap.containsKey(deltaObjUid);
}
- public TsDeviceMetadataIndex getDeviceMetadataIndex(String deltaObjUid) {
+ public TsDeviceMetadataIndex getDeviceMetadataIndex(String deltaObjUid) throws IOException {
+ if (!this.deviceIndexMap.containsKey(deltaObjUid)) {
+ throw new IOException("No measurement path : " + deltaObjUid);
+ }
return this.deviceIndexMap.get(deltaObjUid);
}
diff --git a/tsfile/src/test/java/org/apache/iotdb/tsfile/read/ReadOnlyTsFileTest.java b/tsfile/src/test/java/org/apache/iotdb/tsfile/read/ReadOnlyTsFileTest.java
index 1a509d1..b365ccf 100644
--- a/tsfile/src/test/java/org/apache/iotdb/tsfile/read/ReadOnlyTsFileTest.java
+++ b/tsfile/src/test/java/org/apache/iotdb/tsfile/read/ReadOnlyTsFileTest.java
@@ -110,12 +110,13 @@ public class ReadOnlyTsFileTest {
@Test
public void test2() throws InterruptedException, WriteProcessException, IOException {
- int minRowCount = 1000, maxRowCount=100000;
+ int minRowCount = 1000, maxRowCount = 100000;
TSFileDescriptor.getInstance().getConfig().setTimeEncoder("TS_2DIFF");
TsFileGeneratorForTest.generateFile(minRowCount, maxRowCount, 16 * 1024 * 1024, 10000);
fileReader = new TsFileSequenceReader(FILE_PATH);
tsFile = new ReadOnlyTsFile(fileReader);
queryTest2();
+ queryNonExistPathTest();
tsFile.close();
TsFileGeneratorForTest.after();
}
@@ -139,5 +140,19 @@ public class ReadOnlyTsFileTest {
}
Assert.assertEquals(10647, cnt);
}
+
+ void queryNonExistPathTest() {
+ ArrayList<Path> paths = new ArrayList<>();
+ paths.add(new Path("dr.s1"));
+ paths.add(new Path("d2.s1"));
+ IExpression expression = new GlobalTimeExpression(TimeFilter.gt(1480562664760L));
+ QueryExpression queryExpression = QueryExpression.create(paths, expression);
+ try {
+ QueryDataSet queryDataSet = tsFile.query(queryExpression);
+ } catch (IOException e) {
+ Assert.assertNotNull(e.getMessage(), "No measurement path : dr");
+ }
+ }
+
}