This is an automated email from the ASF dual-hosted git repository.
lta pushed a commit to branch cluster
in repository https://gitbox.apache.org/repos/asf/incubator-iotdb.git
The following commit(s) were added to refs/heads/cluster by this push:
new 2742e0a fix bug of manager metadata
2742e0a is described below
commit 2742e0a2c4b04ece0ad297f10a480b05e199719f
Author: lta <[email protected]>
AuthorDate: Tue Apr 9 01:37:29 2019 +0800
fix bug of manager metadata
---
.../cluster/qp/executor/QueryMetadataExecutor.java | 13 +++++-
.../cluster/integration/IoTDBMetadataFetchIT.java | 52 +++++++++++-----------
2 files changed, 38 insertions(+), 27 deletions(-)
diff --git
a/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/QueryMetadataExecutor.java
b/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/QueryMetadataExecutor.java
index a96bd60..f138c12 100644
---
a/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/QueryMetadataExecutor.java
+++
b/cluster/src/main/java/org/apache/iotdb/cluster/qp/executor/QueryMetadataExecutor.java
@@ -55,6 +55,7 @@ public class QueryMetadataExecutor extends ClusterQPExecutor {
private static final Logger LOGGER =
LoggerFactory.getLogger(QueryMetadataExecutor.class);
private static final String DOUB_SEPARATOR = "\\.";
+ private static final char SINGLE_SEPARATOR = '.';
public QueryMetadataExecutor() {
super();
@@ -93,7 +94,17 @@ public class QueryMetadataExecutor extends ClusterQPExecutor
{
if (storageGroup.length() >= queryPath.length()) {
paths.add(storageGroup);
} else {
- paths.add(storageGroup + queryPath.substring(storageGroup.length()));
+ StringBuilder path = new StringBuilder();
+ String[] storageGroupNodes = storageGroup.split(DOUB_SEPARATOR);
+ String[] queryPathNodes = queryPath.split(DOUB_SEPARATOR);
+ for(int i = 0 ; i < queryPathNodes.length ; i++){
+ if(i >= storageGroupNodes.length){
+ path.append(queryPathNodes[i]).append(SINGLE_SEPARATOR);
+ } else {
+ path.append(storageGroupNodes[i]).append(SINGLE_SEPARATOR);
+ }
+ }
+ paths.add(path.deleteCharAt(path.length()-1).toString());
}
}
return paths;
diff --git
a/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchIT.java
b/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchIT.java
index fb0be10..a94d827 100644
---
a/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchIT.java
+++
b/cluster/src/test/java/org/apache/iotdb/cluster/integration/IoTDBMetadataFetchIT.java
@@ -80,7 +80,7 @@ public class IoTDBMetadataFetchIT {
Connection connection = null;
try {
connection = DriverManager.getConnection(Config.IOTDB_URL_PREFIX +
"127.0.0.1:6667/", "root", "root");
- insertSQL(connection, true);
+ insertSQL(connection, false);
testShowTimeseries(connection);
testShowTimeseriesPath(connection);
} finally {
@@ -151,36 +151,36 @@ public class IoTDBMetadataFetchIT {
Statement statement = connection.createStatement();
String[] sqls = new String[]{
"show timeseries root.ln.wf01.wt01.status", // full seriesPath
-// "show timeseries root.ln", // prefix seriesPath
-// "show timeseries root.ln.wf01.wt01", // prefix seriesPath
-// "show timeseries root.ln.*.wt01.status", // seriesPath with stars
-// "show timeseries root.ln.*.wt01.*", // seriesPath with stars
-// "show timeseries root.a.b", // nonexistent timeseries, thus
returning ""
-// "show timeseries root.ln,root.ln",
+ "show timeseries root.ln", // prefix seriesPath
+ "show timeseries root.ln.wf01.wt01", // prefix seriesPath
+ "show timeseries root.ln.*.wt01.status", // seriesPath with stars
+ "show timeseries root.ln.*.wt01.*", // seriesPath with stars
+ "show timeseries root.a.b", // nonexistent timeseries, thus returning
""
+ "show timeseries root.ln,root.ln",
// SHOW TIMESERIES <PATH> only accept single seriesPath, thus
// returning ""
};
String[] standards = new String[]{
"root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n",
-// "root.ln.wf04.wt04.status,root.ln.wf04,TEXT,PLAIN,\n"
-// +"root.ln.wf04.wt05.temperature,root.ln.wf04,FLOAT,GORILLA,\n"
-// +"root.ln.wf03.wt02.status,root.ln.wf03,INT64,PLAIN,\n"
-// +"root.ln.wf03.wt03.temperature,root.ln.wf03,FLOAT,TS_2DIFF,\n"
-// +"root.ln.wf02.wt03.status,root.ln.wf02,INT32,PLAIN,\n"
-// +"root.ln.wf02.wt04.temperature,root.ln.wf02,FLOAT,RLE,\n"
-// +"root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
-// +"root.ln.wf01.wt01.temperature,root.ln.wf01,FLOAT,RLE,\n"
-// +"root.ln.wf01.wt02.humidity,root.ln.wf01,DOUBLE,RLE,\n"
-// +"root.ln.wf05.wt01.status,root.ln.wf05,DOUBLE,PLAIN,\n",
-// "root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
-// +"root.ln.wf01.wt01.temperature,root.ln.wf01,FLOAT,RLE,\n",
-// "root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
-// + "root.ln.wf05.wt01.status,root.ln.wf05,DOUBLE,PLAIN,\n",
-// "root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
-// + "root.ln.wf01.wt01.temperature,root.ln.wf01,FLOAT,PLAIN,\n"
-// + "root.ln.wf05.wt01.status,root.ln.wf05,DOUBLE,PLAIN,\n",
-// "",
-// ""
+ "root.ln.wf04.wt04.status,root.ln.wf04,TEXT,PLAIN,\n"
+ +"root.ln.wf04.wt05.temperature,root.ln.wf04,FLOAT,GORILLA,\n"
+ +"root.ln.wf03.wt02.status,root.ln.wf03,INT64,PLAIN,\n"
+ +"root.ln.wf03.wt03.temperature,root.ln.wf03,FLOAT,TS_2DIFF,\n"
+ +"root.ln.wf02.wt03.status,root.ln.wf02,INT32,PLAIN,\n"
+ +"root.ln.wf02.wt04.temperature,root.ln.wf02,FLOAT,RLE,\n"
+ +"root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
+ +"root.ln.wf01.wt01.temperature,root.ln.wf01,FLOAT,RLE,\n"
+ +"root.ln.wf01.wt02.humidity,root.ln.wf01,DOUBLE,RLE,\n"
+ +"root.ln.wf05.wt01.status,root.ln.wf05,DOUBLE,PLAIN,\n",
+ "root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
+ +"root.ln.wf01.wt01.temperature,root.ln.wf01,FLOAT,RLE,\n",
+ "root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
+ + "root.ln.wf05.wt01.status,root.ln.wf05,DOUBLE,PLAIN,\n",
+ "root.ln.wf01.wt01.status,root.ln.wf01,BOOLEAN,PLAIN,\n"
+ + "root.ln.wf01.wt01.temperature,root.ln.wf01,FLOAT,RLE,\n"
+ + "root.ln.wf05.wt01.status,root.ln.wf05,DOUBLE,PLAIN,\n",
+ "",
+ ""
};
checkCorrectness(sqls, standards, statement);
}